/**
  * Close the given Connection.
  *
  * @param con the Connection to close
  */
 protected void closeConnection(Connection con) {
   try {
     con.close();
   } catch (Throwable ex) {
     logger.warn("Could not close shared CCI Connection", ex);
   }
 }
Example #2
0
 /**
  * Closes a connection object from the given connection factory.
  *
  * <p>The default implementation assumes a JCA {@link Connection}. Subclasses should override, if
  * they use another type of connection.
  *
  * @param connection
  * @param factory
  */
 public void closeConnection(C connection, F factory) {
   if (connection == null) {
     return;
   }
   if (connection instanceof Connection) {
     try {
       ((Connection) connection).close();
     } catch (ResourceException e) {
       LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Error closing"); // $NON-NLS-1$
     }
     return;
   }
   throw new AssertionError(
       "A connection was created, but no implementation provided for closeConnection"); //$NON-NLS-1$
 }
 /**
  * This method closes the interaction and the connection to a JRA resource.
  *
  * @return True if successful, false if not.
  */
 public void closeConnectionInteraction() {
   try {
     try {
       if (interaction != null) {
         interaction.close();
       }
     } catch (Throwable e) {
       TransactionHelper.logDataException(
           callingFunctionName, "Failure closing the interaction with: ", e);
     }
     if (connection != null) {
       connection.close();
     }
   } catch (Throwable e) {
     TransactionHelper.logDataException(
         callingFunctionName, "Failure closeConnectionInteraction: ", e);
   }
 }
 /**
  * This method opens a connection and the interaction.
  *
  * @return True if successful, false if not.
  */
 public void createConnectionInteraction() {
   if (this.connectionFactory == null) {
     TransactionHelper.logAndThrowDataException(
         callingFunctionName,
         "Failure looking up a connection factory for resource name: " + resourceName,
         null);
   }
   try {
     /*
      * Get a connection from the connection factory. Requires that
      * setupConnectionFactory was called successfully beforehand.
      */
     connection = connectionFactory.getConnection();
     /*
      * Create an interaction object to make a call to an SAP system
      * where you can send your business data and receive data back:
      */
     interaction = connection.createInteraction();
   } catch (Throwable e) {
     TransactionHelper.logAndThrowDataException(
         callingFunctionName, "Failure getting connection for resource name: " + resourceName, e);
   }
 }
Example #5
0
 public void cnCloseConn() throws Exception {
   log.info(tid() + " CN_CLOSE_CONN (" + id + ")");
   Connection conn = (Connection) connections.get(id);
   conn.close();
 }