Package org.infinispan.loaders

Examples of org.infinispan.loaders.CacheLoaderException


      if (!(isCacheReady() && isLocalCall())) return null;
      ClusteredGetCommand clusteredGetCommand = new ClusteredGetCommand(key, cache.getName());
      List<Response> response = doRemoteCall(clusteredGetCommand);
      if (response.isEmpty()) return null;
      if (response.size() > 1)
         throw new CacheLoaderException("Response length is always 0 or 1, received: " + response);
      Response firstResponse = response.get(0);
      if (firstResponse.isSuccessful() && firstResponse instanceof SuccessfulResponse) {
         return (InternalCacheEntry) ((SuccessfulResponse) firstResponse).getResponseValue();
      }

      String message = "Unknown response from remote cache: " + response;
      log.error(message);
      throw new CacheLoaderException(message);
   }
View Full Code Here


      ResponseFilter filter = new ClusteredGetResponseValidityFilter(validMembers);
      try {
         return rpcManager.invokeRemotely(null, clusteredGetCommand, ResponseMode.WAIT_FOR_VALID_RESPONSE, config.getRemoteCallTimeout(), false, filter);
      } catch (Exception e) {
         log.error("error while doing remote call", e);
         throw new CacheLoaderException(e);
      }
   }
View Full Code Here

   @Override
   public void start() throws CacheLoaderException {
      super.start();
      if (configuration == null) {
        throw new CacheLoaderException("Null config. Possible reason is not calling super.init(...)");
      }
      log.tracef("Starting cache with config: %s", configuration);

      locks = new StripedLock(configuration.lockConcurrencyLevel());
      globalLockTimeoutMillis = configuration.lockAcquistionTimeout();
View Full Code Here

   }

   @Override
   public final Set<InternalCacheEntry> loadAll() throws CacheLoaderException {
      if (!acquireGlobalLock(false)) {
         throw new CacheLoaderException("Unable to acquire global lock");
      }
      try {
         return loadAllLockSafe();
      } finally {
         releaseGlobalLock(false);
View Full Code Here

   public final Set<InternalCacheEntry> load(int maxEntries) throws CacheLoaderException {
      if (maxEntries < 0) {
         return loadAll();
      }
      if (!acquireGlobalLock(false)) {
         throw new CacheLoaderException("Unable to acquire global lock");
      }
      try {
         return loadLockSafe(maxEntries);
      } finally {
         releaseGlobalLock(false);
View Full Code Here

   }

   @Override
   public Set<Object> loadAllKeys(Set<Object> keysToExclude) throws CacheLoaderException {
      if (!acquireGlobalLock(false)) {
         throw new CacheLoaderException("Unable to acquire global lock");
      }
      try {
         return loadAllKeysLockSafe(keysToExclude);
      } finally {
         releaseGlobalLock(false);
View Full Code Here

   }

   @Override
   public final void fromStream(ObjectInput objectInput) throws CacheLoaderException {
      if (!acquireGlobalLock(true)) {
         throw new CacheLoaderException("Unable to acquire global lock");
      }
      try {
         fromStreamLockSafe(objectInput);
      } finally {
         releaseGlobalLock(true);
View Full Code Here

   }

   @Override
   public void toStream(ObjectOutput objectOutput) throws CacheLoaderException {
      if (!acquireGlobalLock(false)) {
         throw new CacheLoaderException("Unable to acquire global lock");
      }
      try {
         toStreamLockSafe(objectOutput);
      } finally {
         releaseGlobalLock(false);
View Full Code Here

   public final void clear() throws CacheLoaderException {
      if (trace) {
         log.trace("Clearing store");
      }
      if (!acquireGlobalLock(true)) {
         throw new CacheLoaderException("Unable to acquire global lock");
      }
      try {
         clearLockSafe();
      } finally {
         releaseGlobalLock(true);
View Full Code Here

      Response response;
      if (responses.size() > 1) {
         // Remove duplicates before deciding if multiple responses were received
         Set<Response> setResponses = new HashSet<Response>(responses);
         if (setResponses.size() > 1)
            throw new CacheLoaderException(String.format(
                  "Responses contains more than 1 element and these elements are not equal, so can't decide which one to use: %s",
                  setResponses));
         response = setResponses.iterator().next();
      } else {
         response = responses.iterator().next();
      }

      if (response.isSuccessful() && response instanceof SuccessfulResponse) {
         InternalCacheValue value = (InternalCacheValue) ((SuccessfulResponse) response).getResponseValue();
         return value.toInternalCacheEntry(key);
      }

      log.unknownResponsesFromRemoteCache(responses);
      throw new CacheLoaderException("Unknown responses");
   }
View Full Code Here

TOP

Related Classes of org.infinispan.loaders.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.