Package org.infinispan.persistence

Examples of org.infinispan.persistence.CacheLoaderException


         logBefore(true);
         Connection connection = pooledDataSource.getConnection();
         logAfter(connection, true);
         return connection;
      } catch (SQLException e) {
         throw new CacheLoaderException("Failed obtaining connection from PooledDataSource", e);
      }
   }
View Full Code Here


      SimpleConnectionFactoryConfiguration factoryConfiguration;
      if (config instanceof SimpleConnectionFactoryConfiguration) {
         factoryConfiguration = (SimpleConnectionFactoryConfiguration) config;
      }
      else {
         throw new CacheLoaderException("ConnectionFactoryConfiguration has to be an instance of " +
               "SimpleConnectionFactoryConfiguration.");
      }

      loadDriver(factoryConfiguration.driverClass(), classLoader);
      this.connectionUrl = factoryConfiguration.connectionUrl();
View Full Code Here

   @Override
   public Connection getConnection() throws CacheLoaderException {
      try {
         Connection connection = DriverManager.getConnection(connectionUrl, userName, password);
         if (connection == null)
            throw new CacheLoaderException("Received null connection from the DriverManager!");
         connectionCount++;
         return connection;
      } catch (SQLException e) {
         throw new CacheLoaderException("Could not obtain a new connection", e);
      }
   }
View Full Code Here

         ManagedConnectionFactoryConfiguration managedConfiguration = (ManagedConnectionFactoryConfiguration)
               factoryConfiguration;
         datasourceName = managedConfiguration.jndiUrl();
      }
      else {
         throw new CacheLoaderException("FactoryConfiguration has to be an instance of " +
               "ManagedConnectionFactoryConfiguration");
      }
      try {
         ctx = new InitialContext();
         dataSource = (DataSource) ctx.lookup(datasourceName);
         if (trace) {
            log.tracef("Datasource lookup for %s succeeded: %b", datasourceName, dataSource);
         }
         if (dataSource == null) {
            log.connectionInJndiNotFound(datasourceName);
            throw new CacheLoaderException(String.format(
                  "Could not find a connection in jndi under the name '%s'", datasourceName));
         }
      }
      catch (NamingException e) {
         log.namingExceptionLookingUpConnection(datasourceName, e);
         throw new CacheLoaderException(e);
      }
      finally {
         if (ctx != null) {
            try {
               ctx.close();
View Full Code Here

      Connection connection;
      try {
         connection = dataSource.getConnection();
      } catch (SQLException e) {
         log.sqlFailureRetrievingConnection(e);
         throw new CacheLoaderException("This might be related to https://jira.jboss.org/browse/ISPN-604", e);
      }
      if (trace) {
         log.tracef("Connection checked out: %s", connection);
      }
      return connection;
View Full Code Here

      } catch (Throwable t) {
         if (cause == null) cause = t;
         log.debug("Exception while stopping", t);
      }
      if (cause != null) {
         throw new CacheLoaderException("Exceptions occurred while stopping store", cause);
      }
   }
View Full Code Here

         ps = connection.prepareStatement(sql);
         updateStatement(entry, keyStr, ps);
         ps.executeUpdate();
      } catch (SQLException ex) {
         log.sqlFailureStoringKey(keyStr, ex);
         throw new CacheLoaderException(String.format("Error while storing string key to database; key: '%s'", keyStr), ex);
      } catch (InterruptedException e) {
         if (log.isTraceEnabled()) {
            log.trace("Interrupted while marshalling to store");
         }
         Thread.currentThread().interrupt();
View Full Code Here

            KeyValuePair<ByteBuffer, ByteBuffer> icv = JdbcUtil.unmarshall(ctx.getMarshaller(), inputStream);
            storedValue = ctx.getMarshalledEntryFactory().newMarshalledEntry(key, icv.getKey(), icv.getValue());
         }
      } catch (SQLException e) {
         log.sqlFailureReadingKey(key, lockingKey, e);
         throw new CacheLoaderException(String.format(
               "SQL error while fetching stored entry with key: %s, lockingKey: %s",
               key, lockingKey), e);
      } finally {
         JdbcUtil.safeClose(rs);
         JdbcUtil.safeClose(ps);
View Full Code Here

         ps = connection.prepareStatement(sql);
         ps.setString(1, keyStr);
         return ps.executeUpdate() == 1;
      } catch (SQLException ex) {
         log.sqlFailureRemovingKeys(ex);
         throw new CacheLoaderException("Error while removing string keys from database", ex);
      } finally {
         JdbcUtil.safeClose(ps);
         connectionFactory.releaseConnection(connection);
      }
   }
View Full Code Here

         if (log.isTraceEnabled()) {
            log.tracef("Successfully removed %d rows.", result);
         }
      } catch (SQLException ex) {
         log.failedClearingJdbcCacheStore(ex);
         throw new CacheLoaderException("Failed clearing cache store", ex);
      } finally {
         JdbcUtil.safeClose(ps);
         connectionFactory.releaseConnection(conn);
      }
   }
View Full Code Here

TOP

Related Classes of org.infinispan.persistence.CacheLoaderException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.