private String initialize( Subject subject ) { String userName = null; if (subject != null) { for (Principal principal : subject.getPrincipals()) { if (principal instanceof Group) { Group group = (Group)principal; Enumeration<? extends Principal> roles = group.members(); while (roles.hasMoreElements()) { Principal role = roles.nextElement(); entitlements.add(role.getName()); } } else { userName = principal.getName(); LOGGER.debug("Adding principal user name: " + userName); } } } return userName; }
protected boolean setBeanPropertyIfExistsAndNotSet( Object target, String propertyName, Object value ) { Reflection reflection = new Reflection(target.getClass()); try { if (reflection.invokeGetterMethodOnTarget(propertyName, target) == null) { reflection.invokeSetterMethodOnTarget(propertyName, target, value); return true; } return false; } catch (Exception e) { // Log that the property was not found ... Logger.getLogger(getClass()) .debug("Unknown property '{0}' on '{1}' class", propertyName, target.getClass().getName()); return false; } }
/** * Method called by {@link #unregister()} that actually does the unregistering. This method is final. */ protected final void doUnregister() { // Unregister this listener from each source ... for (ChangeSourceReference sourceReference : sources) { Observable source = sourceReference.get(); if (source != null) { try { source.unregister(this); } catch (Throwable t) { Logger.getLogger(getClass()).debug(t, "Error while unregistering {0} from {1}", this, source); } } } }
/** * {@inheritDoc} * * @see org.modeshape.graph.query.optimize.Optimizer#optimize(QueryContext, PlanNode) */ public PlanNode optimize( QueryContext context, PlanNode plan ) { LinkedList<OptimizerRule> rules = new LinkedList<OptimizerRule>(); populateRuleStack(rules, context.getHints()); Problems problems = context.getProblems(); while (rules.peek() != null && !problems.hasErrors()) { OptimizerRule nextRule = rules.poll(); LOGGER.debug("Running query optimizer rule {0}", nextRule); plan = nextRule.execute(context, plan, rules); } return plan; }
public CallLoadMultipleTimes( int count ) { Logger.getLogger(RepositorySourceLoadHarness.class).debug("Creating repository operation to call {0} times", count); this.count = count; }
/** * Broadcast the supplied changes to the registered observers. * * @param changes the changes to broadcast * @throws IllegalArgumentException if the changes reference is null */ public void broadcast( Changes changes ) { CheckArg.isNotNull(changes, "changes"); for (ObserverReference observerReference : observers) { Observer observer = observerReference.get(); if (observer == null) { observers.remove(observerReference); continue; } try { observer.notify(changes); } catch (Throwable t) { Logger.getLogger(getClass()).debug(t, "Exception while notifying"); } } }
if (security != null) java.security.AccessController.checkPermission(shutdownPerm); LOGGER.debug("Shutting down repository connection pool for {0}", getSourceName()); boolean fullyTerminated = false; final ReentrantLock mainLock = this.mainLock; runState = TERMINATED; termination.signalAll(); LOGGER.debug("Terminated repository connection pool for {0}", getSourceName());
if (security != null) java.security.AccessController.checkPermission(shutdownPerm); LOGGER.debug("Shutting down (immediately) repository connection pool for {0}", getSourceName()); boolean fullyTerminated = false; final ReentrantLock mainLock = this.mainLock; runState = TERMINATED; termination.signalAll(); LOGGER.debug("Terminated repository connection pool for {0}", getSourceName());
/** * {@inheritDoc} * * @see org.modeshape.graph.property.ValueFactory#create(org.modeshape.graph.property.Binary) */ public String create( Binary value ) throws ValueFormatException, IoException { if (value == null) return null; try { value.acquire(); InputStream stream = value.getStream(); try { return create(stream, value.getSize()); } finally { try { stream.close(); } catch (IOException e) { Logger.getLogger(getClass()).debug(e, "Error closing the stream while converting from Binary to String"); } } } finally { value.release(); } }
LOGGER.debug("Unable to set '{0}' property from sequencer configuration on '{1}' stream sequencer implementation", propertyName, streamSequencerClass.getName());
assert original != null; try { LOGGER.debug("Closing repository connection to {0} ({1} open connections remain)", getSourceName(), poolSize); original.close(); } finally {
/** * {@inheritDoc} * * @see org.modeshape.graph.connector.RepositoryOperation#run(org.modeshape.graph.ExecutionContext, * org.modeshape.graph.connector.RepositoryConnection) */ public Integer run( ExecutionContext context, RepositoryConnection connection ) throws RepositorySourceException { Logger.getLogger(RepositorySourceLoadHarness.class).debug("Running {0} operation", this.getClass().getSimpleName()); int total = count; for (int i = 0; i != count; ++i) { // Add two random numbers ... int int1 = random(this.hashCode() ^ (int)System.nanoTime() * i); if (i % 2 == 0) { Thread.yield(); } connection.execute(context, new ReadNodeRequest(Location.create(RootPath.INSTANCE), "workspace1")); int int2 = random(this.hashCode() ^ (int)System.nanoTime() + i); total += Math.min(Math.abs(Math.max(int1, int2) + int1 * int2 / 3), count); } Logger.getLogger(RepositorySourceLoadHarness.class).debug("Finishing {0} operation", this.getClass().getSimpleName()); return total < count ? total : count; // should really always return count } }
try { logger.debug("Garbage collection requested for {0}", source.getName()); CollectGarbageRequest request = new CollectGarbageRequest(); connection.execute(context, request); logger.debug("Garbage collection partially completed for {0}; enqueuing again", source.getName()); } else { logger.debug("Garbage collection completed for {0}", source.getName());