/** * Create a new Coordination Exception with a cause. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param cause The cause associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * and the specified cause is {@code null}. */ public CoordinationException(String message, Coordination coordination, int type, Throwable cause) { super(message, cause); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if ((type == FAILED) && (cause == null)) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * . */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
@Override public void ended(Coordination coordination) throws Exception { LOG.debug("Closing EntityManager for persistence unit " + unitName + " as coordination " + coordination.getName() + " ended."); EntityManager em = removeEm(coordination); emSet.remove(em); em.close(); if (shutdown.get()) { emsToShutDown.countDown(); } } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * . */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException( "A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * . */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * . */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * . */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception with a cause. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param cause The cause associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * and the specified cause is {@code null}. */ public CoordinationException(String message, Coordination coordination, int type, Throwable cause) { super(message, cause); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if ((type == FAILED) && (cause == null)) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception with a cause. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param cause The cause associated with this exception. * @param type The type of this exception. */ public CoordinationException(String message, Coordination coordination, int type, Throwable cause) { super(message, cause); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if ((type == FAILED) && (cause == null)) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * . */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception with a cause. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param cause The cause associated with this exception. * @param type The type of this exception. */ public CoordinationException(String message, Coordination coordination, int type, Throwable cause) { super(message, cause); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if ((type == FAILED) && (cause == null)) { throw new IllegalArgumentException( "A cause must be specified for type FAILED"); } }
@Override public void failed(Coordination coordination) throws Exception { LOG.debug("Coordination failed " + coordination.getName(), coordination.getFailure()); ended(coordination); }
/** * Create a new Coordination Exception with a cause. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param cause The cause associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * and the specified cause is {@code null}. */ public CoordinationException(String message, Coordination coordination, int type, Throwable cause) { super(message, cause); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if ((type == FAILED) && (cause == null)) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param type The type of this exception. */ public CoordinationException(String message, Coordination coordination, int type) { super(message); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if (type == FAILED) { throw new IllegalArgumentException( "A cause must be specified for type FAILED"); } }
/** * Create a new Coordination Exception with a cause. * * @param message The detail message for this exception. * @param coordination The Coordination associated with this exception. * @param cause The cause associated with this exception. * @param type The type of this exception. * @throws IllegalArgumentException If the specified type is {@link #FAILED} * and the specified cause is {@code null}. */ public CoordinationException(String message, Coordination coordination, int type, Throwable cause) { super(message, cause); this.type = type; if (coordination == null) { this.id = -1L; this.name = "<>"; } else { this.id = coordination.getId(); this.name = coordination.getName(); } if ((type == FAILED) && (cause == null)) { throw new IllegalArgumentException("A cause must be specified for type FAILED"); } }
/** * @see org.osgi.service.coordinator.Coordinator#getCoordinations() */ public Collection<Coordination> getCoordinations() { final Collection<Coordination> result = mgr.getCoordinations(); final Iterator<Coordination> i = result.iterator(); while ( i.hasNext() ) { final Coordination c = i.next(); try { this.checkPermission(c.getName(), CoordinationPermission.ADMIN); } catch (final SecurityException se) { i.remove(); } } return result; }
/** * @see org.osgi.service.coordinator.Coordinator#pop() */ public Coordination pop() { Coordination c = mgr.pop(); if ( c != null ) { checkPermission(c.getName(), CoordinationPermission.INITIATE); c = ((CoordinationImpl)c).getHolder(); } return c; }
/** * @see org.osgi.service.coordinator.Coordinator#getCoordination(long) */ public Coordination getCoordination(final long id) { Coordination c = mgr.getCoordinationById(id); if ( c != null ) { try { checkPermission(c.getName(), CoordinationPermission.ADMIN); c = ((CoordinationImpl)c).getHolder(); } catch (final SecurityException e) { c = null; } } return c; }