@Override final public String getLocalizedMessage () { return this.getMessage(); }
@Override final public String getLocalizedMessage () { return this.getMessage(); }
@Override final public String getLocalizedMessage () { return this.getMessage(); }
void onResponseHandlerError (ClientRuntimeException cre, PendingRequest request) { Log.error("Pipeline response handler encountered an error: " + cre.getMessage()); // signal fault onConnectionFault(cre.getMessage(), false); // set execution error for future object request.setCRE(cre); // PendingCPRequest pending = null; while(true){ try { // pending = pendingResponseQueue.remove(); PendingCPRequest[] items = null; items = pendingResponseQueue.remove(); for(PendingCPRequest item : items){ if(item == null) { break; } item.setCRE(cre); Log.error("set pending %s response to error with CRE", item.cmd); } // pending.setCRE(cre); // Log.error("set pending %s response to error with CRE", pending.cmd); } catch (NoSuchElementException empty){ break; } } }
void onResponseHandlerError (ClientRuntimeException cre, PendingRequest request) { Log.error("Pipeline response handler encountered an error: " + cre.getMessage()); // signal fault onConnectionFault(cre.getMessage(), false); // set execution error for future object request.setCRE(cre); // BEST: // 1 - block the request phase // 2 - try reconnect // 3-ok: reconnected, resume processing // 2-not ok: close shop, and set all pending responses to error // for now .. flush the remaining pending responses from queue // with execution error // PendingRequest pending = null; while(true){ try { pending = pendingResponseQueue.remove(); pending.setCRE(cre); Log.error("set pending %s response to error with CRE", pending.cmd); } catch (NoSuchElementException empty){ break; } } } // ------------------------------------------------------------------------
void onResponseHandlerError (ClientRuntimeException cre, PendingRequest request) { Log.error("Pipeline response handler encountered an error: " + cre.getMessage()); // signal fault onConnectionFault(cre.getMessage(), false); // set execution error for future object request.setCRE(cre); // BEST: // 1 - block the request phase // 2 - try reconnect // 3-ok: reconnected, resume processing // 2-not ok: close shop, and set all pending responses to error // for now .. flush the remaining pending responses from queue // with execution error // PendingRequest pending = null; while(true){ try { pending = pendingResponseQueue.remove(); pending.setCRE(cre); Log.error("set pending %s response to error with CRE", pending.cmd); } catch (NoSuchElementException empty){ break; } } } // ------------------------------------------------------------------------
private void onResponseHandlerError (ClientRuntimeException cre, PendingRequest request) { Log.error("Pipeline response handler encountered an error: " + cre.getMessage()); // signal fault onConnectionFault(cre.getMessage(), false); // set execution error for future object request.setCRE(cre); // BEST: // 1 - block the request phase // 2 - try reconnect // 3-ok: reconnected, resume processing // 2-not ok: close shop, and set all pendings to error // for now .. flush the remaining pending resposes from queue // with execution error // PendingRequest pending = null; while(true){ try { pending = pendingResponseQueue.remove(); pending.setCRE(cre); Log.log("set pending %s response to error with CRE", pending.cmd); } catch (NoSuchElementException empty){ break; } } } // ------------------------------------------------------------------------
void onResponseHandlerError (ClientRuntimeException cre, PendingRequest request) { Log.error("Pipeline response handler encountered an error: " + cre.getMessage()); // signal fault onConnectionFault(cre.getMessage(), false); // set execution error for future object request.setCRE(cre); // PendingCPRequest pending = null; while(true){ try { // pending = pendingResponseQueue.remove(); PendingCPRequest[] items = null; items = pendingResponseQueue.remove(); for(PendingCPRequest item : items){ if(item == null) { break; } item.setCRE(cre); Log.error("set pending %s response to error with CRE", item.cmd); } // pending.setCRE(cre); // Log.error("set pending %s response to error with CRE", pending.cmd); } catch (NoSuchElementException empty){ break; } } }
final private Connection createAsyncConnection() { Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY); Connection conn = null; try { conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class); } catch (ProviderException e) { Log.bug("Couldn't create the handler delegate. => " + e.getLocalizedMessage()); throw e; } catch (ClientRuntimeException e) { String msg = String.format("%s\nMake sure your server is running.", e.getMessage()); Log.error ("Error creating connection -> " + e.getLocalizedMessage()); conn = new FaultedConnection(connSpec, msg); } Log.debug ("%s: Using %s", this.getClass().getSimpleName(), conn); return conn; } // ------------------------------------------------------------------------
final private Connection createAsyncConnection() { Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY); Connection conn = null; try { conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class); } catch (ProviderException e) { Log.bug("Couldn't create the handler delegate. => " + e.getLocalizedMessage()); throw e; } catch (ClientRuntimeException e) { String msg = String.format("%s\nMake sure your server is running.", e.getMessage()); Log.error ("Error creating connection -> " + e.getLocalizedMessage()); conn = new FaultedConnection(connSpec, msg); } Log.debug ("%s: Using %s", this.getClass().getSimpleName(), conn); return conn; } // ------------------------------------------------------------------------
final private Connection createAsynchConnection() { Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY); Connection conn = null; try { conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class); } catch (ProviderException e) { Log.bug("Couldn't create the handler delegate. => " + e.getLocalizedMessage()); throw e; } catch (ClientRuntimeException e) { String msg = String.format("%s\nMake sure your server is running.", e.getMessage()); Log.error ("Error creating connection -> " + e.getLocalizedMessage()); conn = new FaultedConnection(connSpec, msg); } Log.debug ("%s: Using %s", this.getClass().getSimpleName(), conn); return conn; } // ------------------------------------------------------------------------
private void run(String password) { try { ConnectionSpec spec = DefaultConnectionSpec.newSpec().setCredentials(password); JRedis jredis = new JRedisClient(spec); jredis.ping(); if(!jredis.exists(bkey)) { jredis.set(bkey, "Hello Again!"); System.out.format("Hello! You should run me again!\n"); } else { String msg = toStr ( jredis.get(bkey) ); System.out.format("%s\n", msg); } jredis.quit(); } catch (RedisException e){ if (e.getCommand()==Command.PING){ System.out.format("I'll need that password! Try again with password as command line arg for this program.\n"); } } catch (ProviderException e){ System.out.format("Oh no, an 'un-documented feature': %s\nKindly report it.", e.getMessage()); } catch (ClientRuntimeException e){ System.out.format("%s\n", e.getMessage()); } } }
/** * Creates a {@link Connection} with {@link Connection.Modality#Synchronous} semantics * suitable for use by synchronous (blocking) JRedis clients. * * @param connSpec connection's specification * @param redisVersion redis protocol compliance * @return */ protected Connection createSyncConnection(ConnectionSpec connSpec){ Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY); Connection conn = null; try { conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class); } catch (ProviderException e) { Log.bug("Couldn't create the handler delegate. => " + e.getLocalizedMessage()); throw e; } catch (ClientRuntimeException e) { String msg = String.format("%s\nMake sure your server is running.", e.getMessage()); Log.error ("Error creating connection -> " + e.getLocalizedMessage()); setConnection(new FaultedConnection(connSpec, msg)); } Log.debug ("%s: Using %s", this.getClass().getSimpleName(), conn); return conn; } // ------------------------------------------------------------------------
/** * Creates a {@link Connection} with {@link Connection.Modality#Synchronous} semantics * suitable for use by synchronous (blocking) JRedis clients. * * @param connSpec connection's specification * @param redisVersion redis protocol compliance * @return */ protected Connection createSyncConnection(ConnectionSpec connSpec){ Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY); Connection conn = null; try { conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class); } catch (ProviderException e) { Log.bug("Couldn't create the handler delegate. => " + e.getLocalizedMessage()); throw e; } catch (ClientRuntimeException e) { String msg = String.format("%s\nMake sure your server is running.", e.getMessage()); Log.error ("Error creating connection -> " + e.getLocalizedMessage()); setConnection(new FaultedConnection(connSpec, msg)); } Log.debug ("%s: Using %s", this.getClass().getSimpleName(), conn); return conn; } // ------------------------------------------------------------------------
/** * Creates a {@link Connection} with {@link Connection.Modality#Synchronous} semantics * suitable for use by synchronous (blocking) JRedis clients. * * @param connSpec connection's specification * @param redisVersion redis protocol compliance * @return */ protected Connection createSynchConnection(ConnectionSpec connSpec){ Connection.Factory cfact = (Connection.Factory) connSpec.getConnectionProperty(Property.CONNECTION_FACTORY); Connection conn = null; try { conn = Assert.notNull(cfact.newConnection(connSpec), "connection delegate", ClientRuntimeException.class); } catch (ProviderException e) { Log.bug("Couldn't create the handler delegate. => " + e.getLocalizedMessage()); throw e; } catch (ClientRuntimeException e) { String msg = String.format("%s\nMake sure your server is running.", e.getMessage()); Log.error ("Error creating connection -> " + e.getLocalizedMessage()); setConnection(new FaultedConnection(connSpec, msg)); } Log.debug ("%s: Using %s", this.getClass().getSimpleName(), conn); return conn; } // ------------------------------------------------------------------------
Log.problem ("ClientRuntimeException: " + cre.getMessage()); onResponseHandlerError(cre, pending); break;
Log.problem ("ClientRuntimeException: " + cre.getMessage()); onResponseHandlerError(cre, pending); break;
Log.problem ("ClientRuntimeException: " + cre.getMessage()); onResponseHandlerError(cre, pending); break;
Log.problem ("ClientRuntimeException: " + cre.getMessage()); onResponseHandlerError(cre, pending); break;
Log.problem ("ClientRuntimeException: " + cre.getMessage()); onResponseHandlerError(cre, pending); break;