Ejemplo n.º 1
0
    @Override
    public Map<String, Object> call() throws Exception {
      final long startTime = System.currentTimeMillis();

      // Fix Classloading issue with ThreadLocal implementation of SessionAccessor
      sessionAccessor.setTenantId(tenantId);
      Thread.currentThread().setContextClassLoader(loader);

      sConnector.setInputParameters(inputParameters);
      try {
        sConnector.validate();
        sConnector.connect();
        return sConnector.execute();
      } finally {
        // in case a session has been created: see ConnectorAPIAccessorImpl
        try {
          final long sessionId = sessionAccessor.getSessionId();
          sessionAccessor.deleteSessionId();
          sessionService.deleteSession(sessionId);
        } catch (final SessionIdNotSetException e) {
          // nothing, no session has been created
        }
        track(
            TimeTrackerRecords.EXECUTE_CONNECTOR_CALLABLE, startTime, sConnector, inputParameters);
      }
    }
Ejemplo n.º 2
0
 @Override
 public void disconnect(final SConnector sConnector) throws SConnectorException {
   try {
     sConnector.disconnect();
   } catch (final SConnectorException e) {
     throw e;
   } catch (final Exception t) {
     throw new SConnectorException(t);
   }
 }
Ejemplo n.º 3
0
 void disconnectSilently(final SConnector sConnector) {
   try {
     sConnector.disconnect();
   } catch (final Exception t) {
     if (loggerService.isLoggable(getClass(), TechnicalLogSeverity.WARNING)) {
       loggerService.log(
           getClass(),
           TechnicalLogSeverity.WARNING,
           "An error occured while disconnecting the connector: " + sConnector,
           t);
     }
   }
 }