List of usage examples for java.util.logging Level FINEST
Level FINEST
To view the source code for java.util.logging Level FINEST.
Click Source Link
From source file:edu.umass.cs.reconfiguration.Reconfigurator.java
private AddressMessenger<JSONObject> getClientMessenger(InetSocketAddress listenSockAddr) { AddressMessenger<JSONObject> cMsgr = this.messenger.getClientMessenger(listenSockAddr); cMsgr = cMsgr != null ? cMsgr : this.messenger; log.log(Level.FINEST, "{0} returning messenger listening on address {1}", new Object[] { this, listenSockAddr, cMsgr }); return cMsgr; }
From source file:io.instacount.appengine.counter.service.ShardedCounterServiceImpl.java
/** * Increment the memcache version of the named-counter by {@code amount} (positive or negative) in an atomic * fashion. Use memcache as a Semaphore/Mutex, and retry up to 10 times if other threads are attempting to update * memcache at the same time. If nothing is in Memcache when this function is called, then do nothing because only * #getCounter should "put" a value to memcache. Additionally, if this operation fails, the cache will be * re-populated after a configurable amount of time, so the count will eventually become correct. * * @param counterName// w w w. ja va 2s.c o m * @param amount * @return The new count of this counter as reflected by memcache */ @VisibleForTesting protected Optional<Long> incrementMemcacheAtomic(final String counterName, final long amount) { Preconditions.checkNotNull(counterName); // Get the cache counter at a current point in time. String memCacheKey = this.assembleCounterKeyforMemcache(counterName); for (int currentRetry = 0; currentRetry < NUM_RETRIES_LIMIT; currentRetry++) { try { final IdentifiableValue identifiableCounter = memcacheService.getIdentifiable(memCacheKey); // See Javadoc about a null identifiableCounter. If it's null, then the named counter doesn't exist in // memcache. if (identifiableCounter == null || (identifiableCounter != null && identifiableCounter.getValue() == null)) { final String msg = "No identifiableCounter was found in Memcache. Unable to Atomically increment for CounterName '%s'. Memcache will be populated on the next called to getCounter()!"; logger.log(Level.FINEST, String.format(msg, counterName)); // This will return an absent value. Only #getCounter should "put" a value to memcache. break; } // If we get here, the count exists in memcache, so it can be atomically incremented/decremented. final BigInteger cachedCounterAmount = (BigInteger) identifiableCounter.getValue(); final long newMemcacheAmount = cachedCounterAmount.longValue() + amount; logger.log(Level.FINEST, String.format("Just before Atomic Increment of %s, Memcache has value: %s", amount, identifiableCounter.getValue())); if (memcacheService.putIfUntouched(counterName, identifiableCounter, BigInteger.valueOf(newMemcacheAmount), config.getDefaultCounterCountExpiration())) { logger.log(Level.FINEST, String.format("MemcacheService.putIfUntouched SUCCESS! with value: %s", newMemcacheAmount)); // If we get here, the put succeeded... return Optional.of(new Long(newMemcacheAmount)); } else { logger.log(Level.WARNING, String.format( "Unable to update memcache counter atomically. Retrying %s more times...", (NUM_RETRIES_LIMIT - currentRetry))); continue; } } catch (MemcacheServiceException mse) { // Check and post-decrement the numRetries counter in one step if ((currentRetry + 1) < NUM_RETRIES_LIMIT) { logger.log(Level.WARNING, String.format( "Unable to update memcache counter atomically. Retrying %s more times...", (NUM_RETRIES_LIMIT - currentRetry))); // Keep trying... continue; } else { // Evict the counter here, and let the next call to getCounter populate memcache final String logMessage = "Unable to update memcache counter atomically, with no more allowed retries. Evicting counter named '%s' from the cache!"; logger.log(Level.SEVERE, String.format(logMessage, (NUM_RETRIES_LIMIT - currentRetry)), mse); this.memcacheSafeDelete(memCacheKey); break; } } } // The increment did not work... return Optional.absent(); }
From source file:com.npower.dm.server.session.ManagementSessionHandler.java
/** * Extracts or create a Chal object that represents how server credentials * should be created.<br>/* w w w . jav a 2 s . c om*/ * If the client challenged the server, we must use the requested auth * mechanism, otherwise, if the server is not logged, we use the default server authentication scheme. * * @param msg the request message * * @return a Chal object representing how server credentials should be * formatted. <code>null</code> if the client not requires the * authentication and if serverAuthType is set to Constants.AUTH_TYPE_NONE */ private Chal getChal(final SyncML msg) { Chal chal = getMessageChal(msg); if (chal == null) { // // client not challenged the server // if (sessionState.serverAuthenticationState != AUTH_ACCEPTED) { // // the server is not logged // if (serverAuthType.equalsIgnoreCase(Constants.AUTH_TYPE_NONE)) { return null; } Meta meta = new Meta(); meta.setType(serverAuthType); meta.setFormat(Constants.FORMAT_CLEAR); meta.setNextNonce(new NextNonce(sessionState.device.getServerNonce())); chal = new Chal(meta); } } else { if (log.isLoggable(Level.FINEST)) { log.finest("Challenged server authentication with scheme " + chal.getType()); } } return chal; }
From source file:com.cloudbees.plugins.credentials.CredentialsProvider.java
/** * Track the usage of credentials in a specific build. * * @param build the run to tag the fingerprint * @param credentials the credentials to fingerprint. * @param <C> the credentials type. * @return the supplied credentials for method chaining. * @since 2.1.1//from w ww . j av a2s. co m */ @NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Run build, @NonNull List<C> credentials) { for (Credentials c : credentials) { if (c != null) { try { getOrCreateFingerprintOf(c).addFor(build); } catch (IOException e) { LOGGER.log(Level.FINEST, "Could not track usage of " + c, e); } } } return credentials; }
From source file:com.npower.dm.server.session.ManagementSessionHandler.java
/** * Checks if the server authentication succedeed. It throws a * ProtocolException if not.// w ww .j a v a2s. c o m * * @param msg the SyncML message to check * * @return true if the server should retry authentication, false otherwise * * @throw ProcotolException if server authentication did not succeed */ private void checkServerAuthentication(SyncML msg) throws ProtocolException { int headerStatusCode = ProtocolUtil.getHeaderStatusCode(msg); if (headerStatusCode == -1) { return; } if ((headerStatusCode == StatusCode.INVALID_CREDENTIALS || headerStatusCode == StatusCode.MISSING_CREDENTIALS)) { /** * The server isn't authorized. * If server has used basic authentication and the client has required * basic authentication means that the server is unable to authenticate * to the client. * If the client has required a authentication type different from that used * from the server, then set the credential for the server to the new authentication * type. * If the authentication type used from the server is equal to that required * from the client (different from basic), the server retries with the same * authentication type (the client could have sent a new nonce) */ String authRequiredFromClient = null; Chal chal = getChal(msg); if (chal != null) { authRequiredFromClient = chal.getType(); } if (serverAuthType.equalsIgnoreCase(Constants.AUTH_TYPE_BASIC) && authRequiredFromClient.equalsIgnoreCase(Constants.AUTH_TYPE_BASIC)) { throw new ProtocolException("Unable to authenticate to the client"); } else if (!authRequiredFromClient.equalsIgnoreCase(serverAuthType)) { serverAuthType = authRequiredFromClient; init.setServerCredentials(engine.getServerCredentials(chal, sessionState.device)); sessionState.serverAuthenticationState = AUTH_RETRY_1; } else if (authRequiredFromClient.equalsIgnoreCase(serverAuthType) && sessionState.serverAuthenticationState == AUTH_UNAUTHENTICATED) { init.setServerCredentials(engine.getServerCredentials(chal, sessionState.device)); sessionState.serverAuthenticationState = AUTH_RETRY_1; } else { throw new ProtocolException("Unable to authenticate to the client"); } return; } else if (headerStatusCode == StatusCode.AUTHENTICATION_ACCEPTED) { // // Authenticated with code 212 // if (log.isLoggable(Level.FINEST)) { log.finest("Server logged (code 212)"); } sessionState.serverAuthenticationState = AUTH_ACCEPTED; } else { // // Authenticated with code 200 // if (log.isLoggable(Level.FINEST)) { log.finest("Server auhenticated (code 200)"); } sessionState.serverAuthenticationState = AUTH_AUTHENTICATED; } }
From source file:com.cloudbees.plugins.credentials.CredentialsProvider.java
/** * Track the usage of credentials in a specific node. * Would be used for example when launching an agent. * @param node the node to tag the fingerprint * @param credentials the credentials to fingerprint. * @param <C> the credentials type. * @return the supplied credentials for method chaining. * @since 2.1.1/* www . j a va 2 s. c o m*/ */ @NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Node node, @NonNull List<C> credentials) { long timestamp = System.currentTimeMillis(); String nodeName = node.getNodeName(); for (Credentials c : credentials) { if (c != null) { try { Fingerprint fingerprint = getOrCreateFingerprintOf(c); BulkChange change = new BulkChange(fingerprint); try { Collection<FingerprintFacet> facets = fingerprint.getFacets(); // purge any old facets long start = timestamp; for (Iterator<FingerprintFacet> iterator = facets.iterator(); iterator.hasNext();) { FingerprintFacet f = iterator.next(); if (f instanceof NodeCredentialsFingerprintFacet && StringUtils.equals(nodeName, ((NodeCredentialsFingerprintFacet) f).getNodeName())) { start = Math.min(start, f.getTimestamp()); iterator.remove(); } } // add in the new one facets.add(new NodeCredentialsFingerprintFacet(node, fingerprint, start, timestamp)); } finally { change.commit(); } } catch (IOException e) { LOGGER.log(Level.FINEST, "Could not track usage of " + c, e); } } } return credentials; }
From source file:com.cloudbees.plugins.credentials.CredentialsProvider.java
/** * Track the usage of credentials in a specific item but not associated with a specific build, for example SCM * polling.//ww w . j av a 2s.c om * * @param item the item to tag the fingerprint against * @param credentials the credentials to fingerprint. * @param <C> the credentials type. * @return the supplied credentials for method chaining. * @since 2.1.1 */ @NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Item item, @NonNull List<C> credentials) { long timestamp = System.currentTimeMillis(); String fullName = item.getFullName(); for (Credentials c : credentials) { if (c != null) { try { Fingerprint fingerprint = getOrCreateFingerprintOf(c); BulkChange change = new BulkChange(fingerprint); try { Collection<FingerprintFacet> facets = fingerprint.getFacets(); // purge any old facets long start = timestamp; for (Iterator<FingerprintFacet> iterator = facets.iterator(); iterator.hasNext();) { FingerprintFacet f = iterator.next(); if (f instanceof ItemCredentialsFingerprintFacet && StringUtils.equals(fullName, ((ItemCredentialsFingerprintFacet) f).getItemFullName())) { start = Math.min(start, f.getTimestamp()); iterator.remove(); } } // add in the new one facets.add(new ItemCredentialsFingerprintFacet(item, fingerprint, start, timestamp)); } finally { change.commit(); } } catch (IOException e) { LOGGER.log(Level.FINEST, "Could not track usage of " + c, e); } } } return credentials; }
From source file:com.npower.dm.server.session.ManagementSessionHandler.java
/** * Create the next Initialization message with commands presents into queues * * @param syncML the hypothetical answer * * @return the server response/* w ww . java2 s .com*/ */ private SyncML createNextMsg(SyncML syncML) throws Sync4jException { if (log.isLoggable(Level.FINEST)) { log.finest("Create Next Message"); } long sizeSyncHdr = sessionState.getOverheadHdr(); long sizeStatusSyncHdr = sessionState.getSizeStatusSyncHdr(); maxSizeAvailable = sessionState.getMaxMsgSize() - sizeSyncHdr - sizeStatusSyncHdr; if (Constants.MIMETYPE_SYNCMLDM_WBXML.equals(mimeType) || Constants.MIMETYPE_SYNCMLDS_WBXML.equals(mimeType)) { maxSizeAvailable -= SizeCalculator.getWBXMLOverheadSyncML(); maxSizeAvailable -= SizeCalculator.getWBXMLOverheadSyncBody(); } else if (Constants.MIMETYPE_SYNCMLDM_XML.equals(mimeType) || Constants.MIMETYPE_SYNCMLDS_XML.equals(mimeType)) { maxSizeAvailable -= SizeCalculator.getXMLOverheadSyncML(); maxSizeAvailable -= SizeCalculator.getXMLOverheadSyncBody(); } // // Checks status // if (log.isLoggable(Level.FINEST)) { log.finest("How many Status can I include into the response?"); } howManyStatus(sessionState.getStatusCmdOut()); sessionState.removeStatusCmdOut(addStatus); // // Checks AbstractCommand // if (log.isLoggable(Level.FINEST)) { log.finest("How many AbstractCommand can I include into the response?"); } howManyAbstractCommand(); sessionState.removeCmdOut(addAbsCmd); int size = addStatus.size() + addAbsCmd.size(); ArrayList commandList = new ArrayList(size); commandList.addAll(addStatus); commandList.addAll(addAbsCmd); AbstractCommand[] absCommands = (AbstractCommand[]) commandList.toArray(new AbstractCommand[size]); // if there is a data splitted in session, the message is not final boolean isFinal = (sessionState.getNextDataToSend() == null); SyncBody responseBody = new SyncBody(absCommands, isFinal); if (log.isLoggable(Level.FINEST)) { log.finest("status in cache after creation: " + sessionState.getStatusCmdOut().size()); log.finest("alert in cache after creation: " + sessionState.getAlertCmdOut().size()); log.finest("command in cache after creation: " + sessionState.getCmdOut().size()); } SyncML newResponse = new SyncML(syncML.getSyncHdr(), responseBody); if (log.isLoggable(Level.FINEST)) { if (Constants.MIMETYPE_SYNCMLDM_WBXML.equals(mimeType) || Constants.MIMETYPE_SYNCMLDS_WBXML.equals(mimeType)) { size = (int) SizeCalculator.getWBXMLSize(newResponse); } else if (Constants.MIMETYPE_SYNCMLDM_XML.equals(mimeType) || Constants.MIMETYPE_SYNCMLDS_XML.equals(mimeType)) { size = (int) SizeCalculator.getXMLSize(newResponse); } log.finest("Response size: " + size); } return newResponse; }
From source file:fr.ortolang.diffusion.core.CoreServiceBean.java
@Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public Collection createCollection(String wskey, String key, String path) throws CoreServiceException, KeyAlreadyExistsException, InvalidPathException, AccessDeniedException, PathNotFoundException, PathAlreadyExistsException, WorkspaceReadOnlyException { LOGGER.log(Level.FINE,// ww w . java2 s . com "creating collection with key [" + key + "] into workspace [" + wskey + "] at path [" + path + "]"); try { PathBuilder npath = PathBuilder.fromPath(path); if (npath.isRoot()) { throw new InvalidPathException("forbidden to create the root collection"); } PathBuilder ppath = npath.clone().parent(); String caller = membership.getProfileKeyForConnectedIdentifier(); List<String> subjects = membership.getConnectedIdentifierSubjects(); authorisation.checkAuthentified(subjects); LOGGER.log(Level.FINEST, "user [" + caller + "] is authentified"); OrtolangObjectIdentifier wsidentifier = registry.lookup(wskey); checkObjectType(wsidentifier, Workspace.OBJECT_TYPE); LOGGER.log(Level.FINEST, "workspace with key [" + wskey + "] exists"); Workspace ws = em.find(Workspace.class, wsidentifier.getId()); if (ws == null) { throw new CoreServiceException( "unable to load workspace with id [" + wsidentifier.getId() + "] from storage"); } if (applyReadOnly(caller, subjects, ws)) { throw new WorkspaceReadOnlyException("unable to create collection in workspace with key [" + wskey + "] because it is read only"); } ws.setKey(wskey); LOGGER.log(Level.FINEST, "workspace loaded"); authorisation.checkPermission(ws.getHead(), subjects, "create"); LOGGER.log(Level.FINEST, "user [" + caller + "] has 'create' permission on the head collection of this workspace"); Collection parent = loadCollectionAtPath(ws.getHead(), ppath, ws.getClock()); LOGGER.log(Level.FINEST, "parent collection loaded for path " + ppath.build()); if (parent.containsElementName(npath.part())) { throw new PathAlreadyExistsException(npath.build()); } String id = UUID.randomUUID().toString(); Collection collection = new Collection(); collection.setId(id); collection.setKey(key); collection.setName(npath.part()); collection.setRoot(false); collection.setClock(ws.getClock()); em.persist(collection); LOGGER.log(Level.FINEST, "collection [" + key + "] created"); Properties properties = new Properties(); properties.put(WORKSPACE_REGISTRY_PROPERTY_KEY, wskey); registry.register(key, collection.getObjectIdentifier(), caller, properties); indexing.index(key); authorisation.clonePolicy(key, ws.getHead()); LOGGER.log(Level.FINEST, "security policy cloned from head collection to key [" + key + "]"); parent.addElement(new CollectionElement(Collection.OBJECT_TYPE, collection.getName(), System.currentTimeMillis(), 0, Collection.MIME_TYPE, key)); em.merge(parent); registry.update(parent.getKey()); LOGGER.log(Level.FINEST, "collection [" + key + "] added to parent [" + parent.getKey() + "]"); ws.setChanged(true); em.merge(ws); registry.update(ws.getKey()); LOGGER.log(Level.FINEST, "workspace set changed"); ArgumentsBuilder argsBuilder = new ArgumentsBuilder(3).addArgument("ws-alias", ws.getAlias()) .addArgument("key", key).addArgument("path", path); notification.throwEvent(wskey, caller, Workspace.OBJECT_TYPE, OrtolangEvent.buildEventType(CoreService.SERVICE_NAME, Collection.OBJECT_TYPE, "create"), argsBuilder.build()); return collection; } catch (KeyLockedException | KeyNotFoundException | RegistryServiceException | NotificationServiceException | IdentifierAlreadyRegisteredException | AuthorisationServiceException | MembershipServiceException | IndexingServiceException e) { LOGGER.log(Level.SEVERE, "unexpected error occurred during collection creation", e); ctx.setRollbackOnly(); throw new CoreServiceException( "unable to create collection into workspace [" + wskey + "] at path [" + path + "]", e); } }
From source file:edu.usu.sdl.openstorefront.service.ComponentServiceImpl.java
@Override public void mapComponentAttributes(Issue issue, ComponentIntegrationConfig integrationConfig) { Objects.requireNonNull(issue, "Jira Issue Required"); Objects.requireNonNull(integrationConfig, "Integration Config Required"); log.finer("Pull Xref Mapping"); AttributeXrefModel attributeXrefModel = new AttributeXrefModel(); attributeXrefModel.setIntegrationType(integrationConfig.getIntegrationType()); attributeXrefModel.setProjectKey(integrationConfig.getProjectType()); attributeXrefModel.setIssueType(integrationConfig.getIssueType()); List<AttributeXRefType> xrefAttributeTypes = getAttributeService() .getAttributeXrefTypes(attributeXrefModel); Map<String, Map<String, String>> xrefAttributeMaps = getAttributeService().getAttributeXrefMapFieldMap(); boolean componentChanged = false; for (AttributeXRefType xrefAttributeType : xrefAttributeTypes) { String jiraValue = null;/* w w w.j a v a2 s .c om*/ if (STATUS_FIELD.equals(xrefAttributeType.getFieldName())) { jiraValue = issue.getStatus().getName(); } else { IssueField jiraField = issue.getField(xrefAttributeType.getFieldId()); if (jiraField != null) { if (jiraField.getValue() instanceof JSONObject) { JSONObject json = (JSONObject) jiraField.getValue(); try { jiraValue = json.getString("value"); } catch (JSONException ex) { throw new OpenStorefrontRuntimeException( "Unable to get field value from: " + jiraField.getValue(), ErrorTypeCode.INTEGRATION); } } else { if (jiraField.getValue() != null) { jiraValue = jiraField.getValue().toString(); } } } else { throw new OpenStorefrontRuntimeException( "Unable to find Jira Field: " + xrefAttributeType.getFieldName(), "Update mapping to match jira.", ErrorTypeCode.INTEGRATION); } } if (StringUtils.isBlank(jiraValue)) { AttributeType attributeType = persistenceService.findById(AttributeType.class, xrefAttributeType.getAttributeType()); if (attributeType != null) { if (Convert.toBoolean(attributeType.getRequiredFlg()) == false) { log.log(Level.FINEST, "Jira Value is Blank....remove any existing component attribute since Attribute type is not require."); ComponentAttributePk componentAttributePk = new ComponentAttributePk(); componentAttributePk.setComponentId(integrationConfig.getComponentId()); componentAttributePk.setAttributeType(xrefAttributeType.getAttributeType()); ComponentAttribute componentAttributeExample = new ComponentAttribute(); componentAttributeExample.setComponentAttributePk(componentAttributePk); persistenceService.deleteByExample(componentAttributeExample); componentChanged = true; } else { log.log(Level.WARNING, MessageFormat.format( "Attribute Type is required and Integration is returned a empty value. Keeping exisiting value on component: {0} Attribute Type: {1}", new Object[] { getComponentService().getComponentName(integrationConfig.getComponentId()), attributeType.getDescription() })); } } else { throw new OpenStorefrontRuntimeException("Unable to find Attribute", "Check Integration mapping.", ErrorTypeCode.INTEGRATION); } } else { String ourAttributeCode = xrefAttributeMaps.get(xrefAttributeType.getAttributeType()) .get(jiraValue); if (ourAttributeCode != null) { ComponentAttributePk componentAttributePk = new ComponentAttributePk(); componentAttributePk.setComponentId(integrationConfig.getComponentId()); componentAttributePk.setAttributeType(xrefAttributeType.getAttributeType()); componentAttributePk.setAttributeCode(ourAttributeCode); if (StringUtils.isBlank(componentAttributePk.getComponentId())) { throw new OpenStorefrontRuntimeException("Component Id is required", ErrorTypeCode.INTEGRATION); } AttributeCodePk attributeCodePk = new AttributeCodePk(); attributeCodePk.setAttributeType(componentAttributePk.getAttributeType()); attributeCodePk.setAttributeCode(componentAttributePk.getAttributeCode()); AttributeCode attributeCode = persistenceService.findById(AttributeCode.class, attributeCodePk); if (attributeCode != null) { AttributeType attributeType = persistenceService.findById(AttributeType.class, attributeCode.getAttributeCodePk().getAttributeType()); if (Convert.toBoolean(attributeType.getAllowMultipleFlg()) == false) { ComponentAttributePk componentAttributeExamplePk = new ComponentAttributePk(); componentAttributeExamplePk.setComponentId(integrationConfig.getComponentId()); componentAttributeExamplePk .setAttributeType(attributeCode.getAttributeCodePk().getAttributeType()); ComponentAttribute componentAttributeExample = new ComponentAttribute(); componentAttributeExample.setComponentAttributePk(componentAttributeExamplePk); long typeCount = persistenceService.countByExample(componentAttributeExample); if (typeCount > 1) { ComponentAttribute example = new ComponentAttribute(); example.setComponentAttributePk(new ComponentAttributePk()); example.getComponentAttributePk() .setAttributeType(componentAttributePk.getAttributeType()); example.getComponentAttributePk() .setComponentId(componentAttributePk.getComponentId()); persistenceService.deleteByExample(example); } } ComponentAttribute existingAttribute = persistenceService.findById(ComponentAttribute.class, componentAttributePk); if (existingAttribute == null || ComponentAttribute.INACTIVE_STATUS.equals(existingAttribute.getActiveStatus())) { ComponentAttribute componentAttribute = new ComponentAttribute(); componentAttribute.setComponentAttributePk(componentAttributePk); componentAttribute.setComponentId(componentAttributePk.getComponentId()); componentAttribute.setActiveStatus(ComponentAttribute.ACTIVE_STATUS); componentAttribute.setCreateUser(OpenStorefrontConstant.SYSTEM_USER); componentAttribute.setUpdateUser(OpenStorefrontConstant.SYSTEM_USER); saveComponentAttribute(componentAttribute, false); componentChanged = true; } else { log.log(Level.FINEST, "Attibute already exists in that state...skipping"); } } else { throw new OpenStorefrontRuntimeException( "Unable to find attribute code. Attribute Type: " + componentAttributePk.getAttributeType() + " Code: " + componentAttributePk.getAttributeCode(), "Check Integration Mapping (Attributes and Input)", ErrorTypeCode.INTEGRATION); } } else { throw new OpenStorefrontRuntimeException( "Unable to find Mapping for Jira Field value: " + jiraValue, ErrorTypeCode.INTEGRATION); } } } if (componentChanged) { updateComponentLastActivity(integrationConfig.getComponentId()); } }