@Override public boolean deleteTicket(final String ticketId) { try { logger.debug("Removing ticket from registry for: {}", ticketId); return this.cache.remove(FQN_TICKET, ticketId) != null; } catch (final CacheException e) { logger.error(e.getMessage(), e); return false; } }
@Override public Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable { throw new CacheException("Not handling " + command + "!"); }
@Override public String toString() { String retval = super.toString(); if (failed_lockers != null && failed_lockers.size() > 0) retval = retval + ", failed lockers: " + failed_lockers; return retval; }
public void print(StringBuilder sb, int indent) { throw new CacheException("This method is deprecated!"); }
@Override public void addTicket(final Ticket ticket) { try { logger.debug("Adding ticket to registry for: {}", ticket.getId()); this.cache.put(FQN_TICKET, ticket.getId(), ticket); } catch (final CacheException e) { logger.error(e.getMessage(), e); throw new RuntimeException(e); } }
private List<ListenerInvocation> getListenerCollectionForAnnotation(Class<? extends Annotation> annotation) { List<ListenerInvocation> list = listenersMap.get(annotation); if (list == null) throw new CacheException("Unknown listener annotation: " + annotation); return list; } }
/** * {@inheritDoc} * Returns a proxied instance. * * @see org.jasig.cas.ticket.registry.TicketRegistry#getTicket(java.lang.String) */ @Override public Ticket getTicket(final String ticketId) { try { logger.debug("Retrieving ticket from registry for: {}", ticketId); return getProxiedTicketInstance(this.cache.get(FQN_TICKET, ticketId)); } catch (final CacheException e) { logger.error(e.getMessage(), e); return null; } }
/** * Sets the cacheStatus to FAILED and rethrows the problem as one * of the declared types. Converts any non-RuntimeException Exception * to CacheException. * * @param t throwable thrown during failure */ private void handleLifecycleTransitionFailure(Throwable t) { state = CacheStatus.FAILED; if (t instanceof CacheException) { throw (CacheException) t; } else if (t instanceof RuntimeException) { throw (RuntimeException) t; } else if (t instanceof Error) { throw (Error) t; } else { throw new CacheException(t); } }
/** * Remove all objects from the Cache. Used on SLEE exit. * * @throws SystemException * */ public void cleanUpCache(String tcache) throws SystemException { try { if (!getTreeCache(tcache).exists(getRootFqn(tcache))) return; // TODO: test to make sure it does what it suppose to do getTreeCache(tcache).remove(getRootFqn(tcache)); /* * Node node = getTreeCache(tcache).get(getRootFqn(tcache)); * node.removeAllChildren(); */ } catch (CacheException ex) { logger .error( "Failed to clean SLEE cache. This could lead to unexpected behaviour! Recommendation: Restart SLEE VM!", ex); throw new SystemException("Failed to clean SLEE cache. " + ex.getMessage()); } }
/** * Retrieves an object referenced by an id * * @param ref reference * @return object */ public Object getReferencedObject(int ref) { if (ref >= referencedObjects.size()) throw new CacheException("Attempting to look up a ref that hasn't been inserted yet"); return referencedObjects.get(ref); }
private void verifyMarker(Object object) { if (object instanceof NodeDataExceptionMarker) { NodeDataExceptionMarker e = (NodeDataExceptionMarker)object; throw new CacheException("Error in state transfer stream", e.getCause()); } else if (! (object instanceof NodeDataMarker)) { throw new CacheException("Invalid object unmarshalled"); } }
private void enqueue(final Modification mod) throws CacheException, InterruptedException { if (stopped.get()) { throw new CacheException("AsyncCacheLoader stopped; no longer accepting more entries."); } if (trace) log.trace("Enqueuing modification " + mod); queue.put(mod); }
/** * @deprecated use {@link #getEvictionAlgorithmConfig()} instead. */ @Deprecated public EvictionPolicyConfig getEvictionPolicyConfig() { if (deprecatedConfig != null) return deprecatedConfig; else throw new CacheException("Not supported. Please use " + EvictionAlgorithmConfig.class.getSimpleName() + " instead of " + EvictionPolicyConfig.class.getSimpleName()); }
@Override protected <T> T construct(Class<T> componentType) { if (componentType.isAssignableFrom(CacheSPI.class) || componentType.isAssignableFrom(Configuration.class) || componentType.isAssignableFrom(ComponentRegistry.class)) { return componentType.cast(cacheSPI); } throw new CacheException("Don't know how to handle type " + componentType); } }
/** * Invokes a method using reflection, in an accessible manner (by using {@link Method#setAccessible(boolean)} * * @param instance instance on which to execute the method * @param method method to execute * @param parameters parameters */ public static void invokeAccessibly(Object instance, Method method, Object[] parameters) { try { method.setAccessible(true); method.invoke(instance, parameters); } catch (Exception e) { throw new CacheException(e); } }
throw new CacheException(e);
private GlobalTransaction getGlobalTransaction(InvocationContext ctx) { // get the current globalTransaction GlobalTransaction gtx = ctx.getGlobalTransaction(); if (gtx == null) { throw new CacheException("failed to get global transaction"); } return gtx; }
private Object getUnmarshalledValue(Object o) { try { return o instanceof MarshalledValue ? ((MarshalledValue) o).get() : o; } catch (Exception e) { throw new CacheException("Unable to unmarshall value", e); } }
/** * @return the {@link org.jboss.cache.transaction.GlobalTransaction}, extracted from the current {@link org.jboss.cache.InvocationContext}. * @throws CacheException if the {@link org.jboss.cache.transaction.GlobalTransaction} or {@link javax.transaction.Transaction} associated with the * {@link org.jboss.cache.InvocationContext} is null. */ protected GlobalTransaction getGlobalTransaction(InvocationContext ctx) throws CacheException { Transaction tx = ctx.getTransaction(); if (tx == null) throw new CacheException("Transaction associated with the current invocation is null!"); GlobalTransaction gtx = ctx.getGlobalTransaction(); if (gtx == null) throw new CacheException("GlobalTransaction associated with the current invocation is null!"); return gtx; }
public void run() { try { method.invoke(target, e); } catch (InvocationTargetException exception) { Throwable cause = exception.getCause(); if (cause != null) throw new CacheException("Caught exception invoking method " + method + " on listener instance " + target, cause); else throw new CacheException("Caught exception invoking method " + method + " on listener instance " + target, exception); } catch (IllegalAccessException exception) { log.warn("Unable to invoke method " + method + " on Object instance " + target + " - removing this target object from list of listeners!", exception); removeCacheListener(target); } } };