Package org.infinispan.commons

Examples of org.infinispan.commons.CacheException


      try {
         // StreamingMarshaller underneath deals with making sure the right classloader is set.
         return marshaller.objectFromByteBuffer(raw.getRaw(), 0, raw.size());
      }
      catch (Exception e) {
         throw new CacheException("Unable to unmarshall value", e);
      }
   }
View Full Code Here


         Map<Address, Response> addressResponseMap = rpcManager.invokeRemotely(null, inDoubtTxInfoCommand,
                                                                               rpcManager.getDefaultRpcOptions(true));
         for (Map.Entry<Address, Response> re : addressResponseMap.entrySet()) {
            Response r = re.getValue();
            if (!isSuccessful(r)) {
               throw new CacheException("Could not fetch in doubt transactions: " + r);
            }
            Set<InDoubtTxInfoImpl> infoInDoubtSet = (Set<InDoubtTxInfoImpl>) ((SuccessfulResponse) r).getResponseValue();
            for (InDoubtTxInfoImpl infoInDoubt : infoInDoubtSet) {
               InDoubtTxInfoImpl inDoubtTxInfo = result.get(infoInDoubt.getXid());
               if (inDoubtTxInfo == null) {
View Full Code Here

   public String forceTransactionCompletionFromCluster(Xid xid, Address where, boolean commit) {
      CompleteTransactionCommand ctc = commandFactory.buildCompleteTransactionCommand(xid, commit);
      Map<Address, Response> responseMap = rpcManager.invokeRemotely(Collections.singleton(where), ctc, rpcManager.getDefaultRpcOptions(true));
      if (responseMap.size() != 1 || responseMap.get(where) == null) {
         log.expectedJustOneResponse(responseMap);
         throw new CacheException("Expected response size is 1, received " + responseMap);
      }
      return (String) ((SuccessfulResponse) responseMap.get(where)).getResponseValue();
   }
View Full Code Here

   }

   @Override
   public void putLookedUpEntry(Object key, CacheEntry e) {
      if (isMarkedForRollback()) {
         throw new CacheException("This transaction is marked for rollback and cannot acquire locks!");
      }
      if (lookedUpEntries == null)
         lookedUpEntries = CollectionFactory.makeMap(4, keyEquivalence, AnyEquivalence.<CacheEntry>getInstance());

      lookedUpEntries.put(key, e);
View Full Code Here

   }

   @Override
   public void putLookedUpEntries(Map<Object, CacheEntry> entries) {
      if (isMarkedForRollback()) {
         throw new CacheException("This transaction is marked for rollback and cannot acquire locks!");
      }
      if (lookedUpEntries == null) {
         lookedUpEntries = CollectionFactory.makeMap(entries, keyEquivalence, AnyEquivalence.<CacheEntry>getInstance());
      } else {
         lookedUpEntries.putAll(entries);
View Full Code Here

         if (transactionSynchronizationRegistry != null) {
            try {
               transactionSynchronizationRegistry.registerInterposedSynchronization(sync);
            } catch (Exception e) {
               log.failedSynchronizationRegistration(e);
               throw new CacheException(e);
            }

         } else {

            try {
               transaction.registerSynchronization(sync);
            } catch (Exception e) {
               log.failedSynchronizationRegistration(e);
               throw new CacheException(e);
            }
         }
         ((SyncLocalTransaction) localTransaction).setEnlisted(true);
      }
   }
View Full Code Here

            } else {
               executeCommandFromLocalCluster(cmd, req, response, preserveOrder);
            }
         } catch (InterruptedException e) {
            log.shutdownHandlingCommand(cmd);
            reply(response, new ExceptionResponse(new CacheException("Cache is shutting down")));
         } catch (Throwable x) {
            if (cmd == null)
               log.errorUnMarshallingCommand(x);
            else
               log.exceptionHandlingCommand(cmd, x);
            reply(response, new ExceptionResponse(new CacheException("Problems invoking command.", x)));
         }
      } else {
         reply(response, null);
      }
   }
View Full Code Here

         public void run() {
            try {
               reply(response, ((XSiteReplicateCommand) cmd).performInLocalSite(receiver));
            } catch (InterruptedException e) {
               log.shutdownHandlingCommand(cmd);
               reply(response, new ExceptionResponse(new CacheException("Cache is shutting down")));
            } catch (Throwable throwable) {
               log.exceptionHandlingCommand(cmd, throwable);
               reply(response, new ExceptionResponse(new CacheException("Problems invoking command.", throwable)));
            }
         }
      });
   }
View Full Code Here

                        retVal = SuccessfulResponse.create(retVal);
                     }
                     reply(response, retVal);
                  } catch (InterruptedException e) {
                     log.shutdownHandlingCommand(cmd);
                     reply(response, new ExceptionResponse(new CacheException("Cache is shutting down")));
                  } catch (Throwable throwable) {
                     log.exceptionHandlingCommand(cmd, throwable);
                     reply(response, new ExceptionResponse(new CacheException("Problems invoking command.", throwable)));
                  }
               }
            });
         } else {
            if (trace) log.tracef("Attempting to execute non-CacheRpcCommand command: %s [sender=%s]", cmd, req.getSrc());
View Full Code Here

   private static Exception wrapThrowableInException(Throwable t) {
      if (t instanceof Exception) {
         return (Exception) t;
      } else {
         return new CacheException(t);
      }
   }
View Full Code Here

TOP

Related Classes of org.infinispan.commons.CacheException

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.