@Override public Connection getConnection() throws PersistenceException { try { return this.factory.getConnection(); } catch (SQLException e) { throw new PersistenceException(e); } }
public final org.infinispan.persistence.spi.PersistenceException errorReadingFileStore(final java.lang.String arg0, final long arg1) { org.infinispan.persistence.spi.PersistenceException result = new org.infinispan.persistence.spi.PersistenceException(java.lang.String.format(errorReadingFileStore$str(), arg0, arg1)); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
public final org.infinispan.persistence.spi.PersistenceException exceptionInCacheLoader(final java.lang.Exception e) { org.infinispan.persistence.spi.PersistenceException result = new org.infinispan.persistence.spi.PersistenceException(java.lang.String.format(exceptionInCacheLoader$str()), e); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
private Object unmarshall(byte[] bytes) { try { return this.ctx.getMarshaller().objectFromByteBuffer(bytes); } catch (IOException | ClassNotFoundException e) { throw new PersistenceException(e); } }
public final org.infinispan.persistence.spi.PersistenceException errorReadingFileStore(final java.lang.String arg0, final long arg1) { org.infinispan.persistence.spi.PersistenceException result = new org.infinispan.persistence.spi.PersistenceException(java.lang.String.format(errorReadingFileStore$str(), arg0, arg1)); java.lang.StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(java.util.Arrays.copyOfRange(st, 1, st.length)); return result; }
private byte[] marshall(Object key) { try { return (key instanceof WrappedByteArray) ? ((WrappedByteArray) key).getBytes() : this.ctx.getMarshaller().objectToByteBuffer(key); } catch (IOException | InterruptedException e) { throw new PersistenceException(e); } }
@Override public final PersistenceException prepareTxFailure(final Throwable e) { final PersistenceException result = new PersistenceException(String.format(getLoggingLocale(), prepareTxFailure$str()), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
@Override public void init(InitializationContext ctx) { this.ctx = ctx; HotRodStoreConfiguration configuration = ctx.getConfiguration(); RemoteCacheContainer remoteCacheContainer = configuration.attributes().attribute(HotRodStoreConfiguration.REMOTE_CACHE_CONTAINER).get(); String cacheConfiguration = configuration.attributes().attribute(HotRodStoreConfiguration.CACHE_CONFIGURATION).get(); String cacheName = ctx.getCache().getName(); try { ProtocolVersion protocolVersion = remoteCacheContainer.getConfiguration().version(); // Administration support was introduced in protocol version 2.7 if (protocolVersion.compareTo(ProtocolVersion.PROTOCOL_VERSION_27) < 0) { this.remoteCache = remoteCacheContainer.getCache(cacheName, false); if (this.remoteCache == null) { throw InfinispanLogger.ROOT_LOGGER.remoteCacheMustBeDefined(protocolVersion.toString(), cacheName); } } else { InfinispanLogger.ROOT_LOGGER.remoteCacheCreated(cacheName, cacheConfiguration); this.remoteCache = remoteCacheContainer.administration().getOrCreateCache(cacheName, cacheConfiguration); } } catch (HotRodClientException ex) { throw new PersistenceException(ex); } }
@Override public final PersistenceException exceptionInCacheLoader(final Exception e) { final PersistenceException result = new PersistenceException(String.format(getLoggingLocale(), exceptionInCacheLoader$str()), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { throw new PersistenceException(cause); }
@Override public final PersistenceException cannotOpenIndex(final String location, final IOException e) { final PersistenceException result = new PersistenceException(String.format(getLoggingLocale(), cannotOpenIndex$str(), location), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String interruptedWhileStopping = "ISPN029014: Interrupted while stopping the store";
@Override public Connection getConnection() throws PersistenceException { try { Connection connection = DriverManager.getConnection(connectionUrl, userName, password); if (connection == null) throw new PersistenceException("Received null connection from the DriverManager!"); connectionCount++; return connection; } catch (SQLException e) { throw new PersistenceException("Could not obtain a new connection", e); } }
@Override public final PersistenceException sizeCalculationInterrupted(final InterruptedException e) { final PersistenceException result = new PersistenceException(String.format(getLoggingLocale(), sizeCalculationInterrupted$str()), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
@Override public Connection getConnection() throws PersistenceException { try { return this.factory.getConnection(); } catch (SQLException e) { throw new PersistenceException(e); } }
@Override public final PersistenceException interruptedWhileStopping(final InterruptedException e) { final PersistenceException result = new PersistenceException(String.format(getLoggingLocale(), interruptedWhileStopping$str()), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String interruptedWhileClearing = "ISPN029015: Interrupted while pausing the index for clear.";
private Map<Object, MarshalledEntry> unmarshallBucketEntries(InputStream inputStream) { try { return (Map<Object, MarshalledEntry>) marshaller.objectFromInputStream(inputStream); } catch (IOException e) { throw new PersistenceException("I/O error while unmarshalling from stream", e); } catch (ClassNotFoundException e) { throw new PersistenceException(e); } } }
@Override public final PersistenceException cannotClearData(final IOException e) { final PersistenceException result = new PersistenceException(String.format(getLoggingLocale(), cannotClearData$str()), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String keyIsTooLong = "ISPN029018: The serialized form of key %s is too long (%d); with maxNodeSize=%d bytes you can use only keys serialized to at most %d bytes.";
@SuppressWarnings("unchecked") private KeyValuePair<ByteBuffer, ByteBuffer> unmarshall(InputStream inputStream) throws PersistenceException { try { return (KeyValuePair<ByteBuffer, ByteBuffer>) marshaller.objectFromInputStream(inputStream); } catch (IOException e) { throw new PersistenceException("I/O error while unmarshalling from stream", e); } catch (ClassNotFoundException e) { throw new PersistenceException(e); } } }
@Override public final PersistenceException httpError(final Throwable t) { final PersistenceException result = new PersistenceException(String.format(getLoggingLocale(), httpError0$str()), t); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String hostNotSpecified = "ISPN022004: Host not specified";
/** * Loads a DynamoDB query executor with the specified class name. * * @param clazz The class. Must not be {@code null}. * * @return The DynamoDB query executor. */ @SuppressWarnings( "unchecked" ) private DynamoDBQueryExecutor<K,V> loadQueryExecutorClass(final Class clazz) { try { Class<DynamoDBQueryExecutor<K,V>> genClazz = (Class<DynamoDBQueryExecutor<K,V>>)clazz; return genClazz.newInstance(); } catch (Exception e) { throw new PersistenceException("Couldn't load DynamoDB query executor class: " + e.getMessage(), e); } }