/** a bit aggressive but to force out the little bugs .. */ protected final void assertResponseRead () { if(!didRead) throw new ProviderException ("Response has not been read yet! -- whose bad?"); }
Log.error ("ProviderException: " + bug.getLocalizedMessage()); bug.printStackTrace(); pending.setCRE(bug); Log.logger.error("Unexpected RuntimeException ", e); e.printStackTrace(); pending.setCRE(new ProviderException("Unexpected runtime exception in response handler")); pending.setResponse(null); break;
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()); } } }
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; } // ------------------------------------------------------------------------
Log.error ("ProviderException: " + bug.getLocalizedMessage()); bug.printStackTrace(); pending.setCRE(bug); Log.error("Unexpected RuntimeException ", e); e.printStackTrace(); pending.setCRE(new ProviderException("Unexpected runtime exception in response handler")); pending.setResponse(null); break;
Log.bug ("ProviderException: " + bug.getMessage()); onResponseHandlerError(bug, pending); 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; } // ------------------------------------------------------------------------
/** a bit aggressive but to force out the little bugs .. */ protected final void assertResponseRead () { if(!didRead) throw new ProviderException ("Response has not been read yet! -- whose bad?"); }
Log.error ("ProviderException: " + bug.getLocalizedMessage()); bug.printStackTrace(); pending.setCRE(bug); Log.error("Unexpected RuntimeException ", e); e.printStackTrace(); pending.setCRE(new ProviderException("Unexpected runtime exception in response handler")); pending.setResponse(null); break;
Log.bug ("ProviderException: " + bug.getMessage()); onResponseHandlerError(bug, pending); break;
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; } // ------------------------------------------------------------------------
@Override public void read(InputStream in) throws ClientRuntimeException, ProviderException { throw new ProviderException("Request.read is not supported by this class! [Apr 2, 2009]"); }
Log.bug ("ProviderException: " + bug.getMessage()); onResponseHandlerError(bug, pending); break;
/** * 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; } // ------------------------------------------------------------------------
/** a bit aggressive but to force out the little bugs .. */ protected final void assertResponseRead () { if(!didRead) throw new ProviderException ("Response has not been read yet! -- whose bad?"); }
Log.bug ("ProviderException: " + bug.getMessage()); onResponseHandlerError(bug, pending); break;