/** * Destroys the underline physical connection to EIS. * * @param connectionObject connection Object. */ @Override void destroyPooledConnection(Object connectionObject) { try { ((ManagedConnection) connectionObject) .removeConnectionEventListener((ConnectionEventListener) connEventListner); ((ManagedConnection) connectionObject).destroy(); connectionObject = null; } catch (ResourceException rex) { if (logger.isTraceEnabled()) { logger.trace( "ManagedPoolcacheImpl::destroyPooledConnection:Exception in closing the connection.Ignoring it. The exeption is {}", rex.getMessage(), rex); } } } }
@ControllerAdvice public class ExceptionHandlerAdvice { @ExceptionHandler(ResourceException.class) public ResponseEntity handleException(ResourceException e) { // log exception return ResponseEntity.status(e.getHttpStatus()).body(e.getMessage()); } }
@SuppressWarnings("unchecked") @Override public CONNECTION_TYPE getConnection() { log.debug("getConnection {} MCF: {}", this.cm, this.mcf); try { return (CONNECTION_TYPE) cm.allocateConnection(mcf, getConnectionRequestdebug()); } catch (ResourceException ex) { throw new RuntimeException(ex.getMessage()); } }
@Override public Bucket getBucket() { out.println("#FileBucketStore.getConnection " + this.cm + " MCF: " + this.mcf); try { return (Bucket) cm.allocateConnection(mcf, getConnectionRequestInfo()); } catch (ResourceException ex) { throw new RuntimeException(ex.getMessage()); } }
@Override public JCAExecutor newExecutor(){ out.println("#WorkManagerExecutorFactory.getConnection " + this.cm + " MCF: " + this.mcf); try { return (JCAExecutor) cm.allocateConnection(mcf, null); } catch (ResourceException ex) { throw new RuntimeException(ex.getMessage(),ex); } }
public Connection getConnection() throws SQLException { if (isDebugOn) { mcf.trace.log(BasicLevel.DEBUG, ""); } try { Connection con = (Connection) cm.allocateConnection(mcf, null); if (con == null) { SQLException se = new SQLException("Null connection object returned"); throw se; } return con; } catch (ResourceException re) { throw new SQLException(re.getMessage()); } }
@Override public Object invoke(final String actionName, final Object[] params, final String[] signature) throws MBeanException, ReflectionException { if (actionName.equals("stop")) { activationContext.stop(); } else if (actionName.equals("start")) { try { activationContext.start(); } catch (ResourceException e) { logger.error("Error invoking " + actionName + ": " + e.getMessage()); throw new MBeanException(new IllegalStateException(e.getMessage(), e)); } } else { throw new MBeanException(new IllegalStateException("unsupported operation: " + actionName)); } return null; }
@Override public Object invoke(final String actionName, final Object[] params, final String[] signature) throws MBeanException, ReflectionException { if (actionName.equals("stop")) { activationContext.stop(); } else if (actionName.equals("start")) { try { activationContext.start(); } catch (ResourceException e) { logger.error("Error invoking " + actionName + ": " + e.getMessage()); throw new MBeanException(new IllegalStateException(e.getMessage(), e)); } } else { throw new MBeanException(new IllegalStateException("unsupported operation: " + actionName)); } return null; }
@Override public Object invoke(final String actionName, final Object[] params, final String[] signature) throws MBeanException, ReflectionException { if (actionName.equals("stop")) { activationContext.stop(); } else if (actionName.equals("start")) { try { activationContext.start(); } catch (ResourceException e) { logger.error("Error invoking " + actionName + ": " + e.getMessage()); throw new MBeanException(new IllegalStateException(e.getMessage(), e)); } } else { throw new MBeanException(new IllegalStateException("unsupported operation: " + actionName)); } return null; }
/** * Returns the composite throwable message. * * @return The composite throwable message. */ public String getMessage() { return NestedThrowable.Util.getMessage(super.getMessage(), getLinkedException()); }
Connection getJaxrConnection() throws JAXRException { checkIfValid(); try { return this.mc.getJaxrConnection(); } catch (ResourceException localResourceException) { throw new JAXRException(ResourceBundle.getBundle("com/sun/connector/jaxr/LocalStrings").getString("Unable_to_obtain_JAXR_Connection_") + localResourceException.getMessage()); } }
public static void close(boolean throwOnError, Consumer<String> logger) { get().ifPresent(connection -> { try { connection.close(); } catch (ResourceException cause) { String message = String.format("Failed to close Pivotal GemFire Connection: %s", cause.getMessage()); if (throwOnError) { throw newRuntimeException(cause, message); } else { logger.accept(message); } } }); } }
public static void close(boolean throwOnError, Consumer<String> logger) { get().ifPresent(connection -> { try { connection.close(); } catch (ResourceException cause) { String message = String.format("Failed to close GemFire Connection: %s", cause.getMessage()); if (throwOnError) { throw newRuntimeException(cause, message); } else { logger.accept(message); } } }); } }
public Connection getConnection(String user, String pwd) throws SQLException { if (isDebugOn) { mcf.trace.log(BasicLevel.DEBUG, "" + user); } try { ConnectionRequestInfoImpl info = new ConnectionRequestInfoImpl(user, pwd); Connection con = (Connection) cm.allocateConnection(mcf, info); if (con == null) { SQLException se = new SQLException("Null connection object returned"); throw se; } return con; } catch (ResourceException re) { throw new SQLException(re.getMessage()); } }
/** * Helper method to create message text for constructor accepting * ResourceException ({@link #FBSQLException(ResourceException)}) * * @param ex * ResourceException * @return Exception message */ @SuppressWarnings("ThrowableResultOfMethodCallIgnored") private static String createResourceMessage(ResourceException ex) { Throwable cause = resolveCause(ex); if (cause instanceof GDSException) { return createGDSExceptionMessage((GDSException) cause); } return "Resource Exception. " + ex.getMessage(); }
/** * Helper method to create message text for constructor accepting * ResourceException ({@link #FBSQLException(ResourceException)}) * * @param ex * ResourceException * @return Exception message */ @SuppressWarnings("ThrowableResultOfMethodCallIgnored") private static String createResourceMessage(ResourceException ex) { Throwable cause = resolveCause(ex); if (cause instanceof GDSException) { return createGDSExceptionMessage((GDSException) cause); } return "Resource Exception. " + ex.getMessage(); }
Connection getConnection(Properties paramProperties) throws JAXRException { try { JaxrConnectionRequestInfo localJaxrConnectionRequestInfo = new JaxrConnectionRequestInfo(paramProperties); return (Connection)this.cm.allocateConnection(this.mcf, localJaxrConnectionRequestInfo); } catch (ResourceException localResourceException) { throw new JAXRException(localResourceException.getMessage()); } }
public Connection getConnection() throws JAXRException { try { JaxrConnectionRequestInfo localJaxrConnectionRequestInfo = null; if (this.properties != null) { localJaxrConnectionRequestInfo = new JaxrConnectionRequestInfo(this.properties); } log.fine("JAXRConnectionFactory getConnection - ConnectionManager calling allocateConnection"); return (Connection)this.cm.allocateConnection(this.mcf, localJaxrConnectionRequestInfo); } catch (ResourceException localResourceException) { throw new JAXRException(localResourceException.getMessage()); } }
public static GFConnection acquire(GFConnectionFactory connectionFactory, boolean throwOnError, Consumer<String> logger) { try { return of(connectionFactory.getConnection()); } catch (ResourceException cause) { String message = String.format("Failed to acquire Pivotal GemFire Connection from GemFire's JCA ResourceAdapter: %s", cause.getMessage()); if (throwOnError) { throw newRuntimeException(cause, message); } else { logger.accept(message); return null; } } }
public static GFConnection acquire(GFConnectionFactory connectionFactory, boolean throwOnError, Consumer<String> logger) { try { return of(connectionFactory.getConnection()); } catch (ResourceException cause) { String message = String.format("Failed to acquire GemFire Connection from GemFire's JCA ResourceAdapter: %s", cause.getMessage()); if (throwOnError) { throw newRuntimeException(cause, message); } else { logger.accept(message); return null; } } }