Skip to content

Redesign connect function #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dizzzz opened this issue Mar 16, 2015 · 5 comments
Open

Redesign connect function #5

dizzzz opened this issue Mar 16, 2015 · 5 comments

Comments

@dizzzz
Copy link
Collaborator

dizzzz commented Mar 16, 2015

  • add map with configuration parameters
  • add separate CouchBaseEnviromnets (seperate ID) for finetune parameters
  • move away from connection string (recommended by @daschl

suppor the following or aliket:

List<String> nodes = Arrays.asList("192.168.56.101", "192.168.56.102");
Cluster cluster = CouchbaseCluster.create(nodes);
@dizzzz
Copy link
Collaborator Author

dizzzz commented Mar 24, 2015

idea:

create separate CBenvironment, with parameters; return id, to be used by creation connection.

CouchbaseEnvironment env = DefaultCouchbaseEnvironment
    .builder()
    .sslEnabled(true)
    .computationPoolSize(5)
    .build();

Cluster cluster = CouchbaseCluster.create(env, "localhost");
couchbase:create-environment($params as map()) as xs:string

with new

couchbase:connect($connection as xs:string, $environment as xs:string) as xs:string

@daschl
Copy link

daschl commented Mar 24, 2015

@dizzzz keep in mind that if you want to make it right and you are passing in an environment you also need to shut it down manually (since we dont know where you are using it too). See http://docs.couchbase.com/developer/java-2.1/managing-connections.html

@dizzzz
Copy link
Collaborator Author

dizzzz commented Mar 24, 2015

Would it be sufficient to use a VM shutdown hook to do the cleanup? (as last resort) http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#addShutdownHook(java.lang.Thread)

@daschl
Copy link

daschl commented Mar 24, 2015

well, it doesn't hurt since all of the threads are daemonized, the main reason is actually to make sure all in flights requests get a chance to be properly handled.

Maybe a shutdown hook works, actually I've never seen it used in practice. Also I'm unsure if it is included or not in "Shutdown hooks should also finish their work quickly. When a program invokes exit the expectation is that the virtual machine will promptly shut down and exit. When the virtual machine is terminated due to user logoff or system shutdown the underlying operating system may only allow a fixed amount of time in which to shut down and exit. It is therefore inadvisable to attempt any user interaction or to perform a long-running computation in a shutdown hook."

@WillemvdW
Copy link
Collaborator

Another issue that should come in here is that the timeout settings for the java sdk is short, and over slow networks, this blocks a connection. The timeout should be configurable.

dizzzz added a commit that referenced this issue Apr 28, 2018
Bump org.exist-db:exist-core and org.exist-db:exist-testkit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants