public void debugNoDb(final Object iRequester, final String iMessage, final Throwable iException, final Object... iAdditionalArgs) { if (isDebugEnabled()) log(iRequester, Level.FINE, iMessage, iException, false, null, iAdditionalArgs); }
public void debug(final Object iRequester, final String iMessage, final Throwable iException, final Object... iAdditionalArgs) { if (isDebugEnabled()) log(iRequester, Level.FINE, iMessage, iException, iAdditionalArgs); }
public void debug(final Object iRequester, final String iMessage, final Object... iAdditionalArgs) { if (isDebugEnabled()) log(iRequester, Level.FINE, iMessage, null, true, null, iAdditionalArgs); }
public void debug(final Object iRequester, final String iMessage, final Object... iAdditionalArgs) { if (isDebugEnabled()) log(iRequester, Level.FINE, iMessage, null, iAdditionalArgs); }
public void debug(final Object iRequester, final String iMessage, final Throwable iException, final Object... iAdditionalArgs) { if (isDebugEnabled()) log(iRequester, Level.FINE, iMessage, iException, true, null, iAdditionalArgs); }
public boolean returnResource(final V res) { if (resourcesOut.remove(res)) { resources.add(res); sem.release(); if (OLogManager.instance().isDebugEnabled()) OLogManager.instance() .debug(this, "pool:'%s' returned resource '%s' available %d out %d", this, res, sem.availablePermits(), resourcesOut.size()); } return true; }
public void remove(final V res) { if (resourcesOut.remove(res)) { this.resources.remove(res); sem.release(); if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "pool:'%s' removed resource '%s' available %d out %d", this, res, sem.availablePermits(), resourcesOut.size()); } }
public synchronized void queryStarted(String id, OResultSet rs) { if (this.activeQueries.size() > 1 && this.activeQueries.size() % 10 == 0) { StringBuilder msg = new StringBuilder(); msg.append("This database instance has "); msg.append(activeQueries.size()); msg.append(" open command/query result sets, please make sure you close them with OResultSet.close()"); OLogManager.instance().warn(this, msg.toString(), null); if (OLogManager.instance().isDebugEnabled()) { activeQueries.values().stream().map(pendingQuery -> pendingQuery.getExecutionPlan()).filter(plan -> plan != null) .forEach(plan -> OLogManager.instance().debug(this, plan.toString())); } } this.activeQueries.put(id, rs); }
/** * Wait until the requested resource is unlocked. Put the current thread in sleep until timeout or is waked up by an unlock. */ public synchronized RESPONSE_TYPE getValue(final RESOURCE_TYPE iResource, final long iTimeout) { if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug( this, "Thread [" + Thread.currentThread().getId() + "] is waiting for the resource " + iResource + (iTimeout <= 0 ? " forever" : " until " + iTimeout + "ms")); synchronized (iResource) { try { iResource.wait(iTimeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new OLockException("Thread interrupted while waiting for resource '" + iResource + "'"); } } Object[] value = queue.remove(iResource); return (RESPONSE_TYPE) (value != null ? value[1] : null); }
if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "Invalidate all cached results (%d)", size()); if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "No results found for '%s'", iCluster); return; if (evicted > 0 && OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "Invalidate %d cached results associated to the cluster '%s'", evicted, iCluster);
private ORawBuffer doReadRecord(final OCluster clusterSegment, final ORecordId rid, final boolean prefetchRecords) { try { final ORawBuffer buff = clusterSegment.readRecord(rid.getClusterPosition(), prefetchRecords); if (buff != null && OLogManager.instance().isDebugEnabled()) { OLogManager.instance() .debug(this, "Read record %s v.%s size=%d bytes", rid, buff.version, buff.buffer != null ? buff.buffer.length : 0); } recordRead.incrementAndGet(); return buff; } catch (final IOException e) { throw OException.wrapException(new OStorageException("Error during read of record with rid = " + rid), e); } }
osMemory = Long.parseLong(attribute.toString()); } catch (final NumberFormatException e) { if (!OLogManager.instance().isDebugEnabled()) OLogManager.instance().warnNoDb(OMemory.class, "Unable to determine the amount of installed RAM."); else if (!OLogManager.instance().isDebugEnabled()) OLogManager.instance().warnNoDb(OMemory.class, "Unable to determine the amount of installed RAM."); if (!OLogManager.instance().isDebugEnabled()) OLogManager.instance().warnNoDb(OMemory.class, "Unable to determine the amount of installed RAM."); else
/** * {@inheritDoc} */ public <DB extends ODatabaseDocument> DB checkSecurity(final ORule.ResourceGeneric iResourceGeneric, final int iOperation, final Object... iResourcesSpecific) { if (user != null) { try { if (iResourcesSpecific.length != 0) { for (Object target : iResourcesSpecific) { if (target != null) { user.allow(iResourceGeneric, target.toString(), iOperation); } else user.allow(iResourceGeneric, null, iOperation); } } else user.allow(iResourceGeneric, null, iOperation); } catch (OSecurityAccessException e) { if (OLogManager.instance().isDebugEnabled()) OLogManager.instance() .debug(this, "[checkSecurity] User '%s' tried to access the reserved resource '%s', target(s) '%s', operation '%s'", getUser(), iResourceGeneric, Arrays.toString(iResourcesSpecific), iOperation); throw e; } } return (DB) this; }
/** * {@inheritDoc} */ public <DB extends ODatabaseDocument> DB checkSecurity(final ORule.ResourceGeneric resourceGeneric, final String resourceSpecific, final int iOperation) { if (user != null) { try { user.allow(resourceGeneric, resourceSpecific, iOperation); } catch (OSecurityAccessException e) { if (OLogManager.instance().isDebugEnabled()) OLogManager.instance() .debug(this, "User '%s' tried to access the reserved resource '%s.%s', operation '%s'", getUser(), resourceGeneric, resourceSpecific, iOperation); throw e; } } return (DB) this; }
/** * {@inheritDoc} */ public <DB extends ODatabaseDocument> DB checkSecurity(final ORule.ResourceGeneric iResourceGeneric, final int iOperation, final Object iResourceSpecific) { checkOpenness(); if (user != null) { try { if (iResourceSpecific != null) user.allow(iResourceGeneric, iResourceSpecific.toString(), iOperation); else user.allow(iResourceGeneric, null, iOperation); } catch (OSecurityAccessException e) { if (OLogManager.instance().isDebugEnabled()) OLogManager.instance() .debug(this, "[checkSecurity] User '%s' tried to access the reserved resource '%s', target '%s', operation '%s'", getUser(), iResourceGeneric, iResourceSpecific, iOperation); throw e; } } return (DB) this; }
private boolean parallelExec(final Iterator<? extends OIdentifiable> iTarget) { final OLegacyResultSet result = (OLegacyResultSet) getResultInstance(); // BROWSE ALL THE RECORDS ON CURRENT THREAD BUT DELEGATE UNMARSHALLING AND FILTER TO A THREAD POOL final ODatabaseDocumentInternal db = getDatabase(); if (limit > -1) { if (result != null) { result.setLimit(limit); } } final boolean res = execParallelWithPool((ORecordIteratorClusters) iTarget, db); if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "Parallel query '%s' completed", parserText); return res; }
@Override public void put(final OSecurityUser iUser, final String queryText, final Object iResult, final int iLimit, Set<String> iInvolvedClusters, final long iExecutionTime) { if (queryText == null || iResult == null) // SKIP IT return; if (!enable) return; if (iExecutionTime < minExecutionTime) // TOO FAST: AVOIDING CACHING IT return; int resultsetSize = 1; if (iResult instanceof OLegacyResultSet) { resultsetSize = ((OLegacyResultSet) iResult).size(); if (resultsetSize > maxResultsetSize) // TOO BIG RESULTSET, SKIP IT return; } if (evictStrategy != STRATEGY.PER_CLUSTER) iInvolvedClusters = null; synchronized (this) { final String key = getKey(iUser, queryText, iLimit); final OCachedResult value = new OCachedResult(iResult, iInvolvedClusters); if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "Storing resultset in cache size=%d", resultsetSize); cache.put(key, value); if (iInvolvedClusters != null) clusters.addAll(iInvolvedClusters); } }
private int addClusterInternal(String clusterName, final int clusterPos, final Object... parameters) throws IOException { final OCluster cluster; if (clusterName != null) { clusterName = clusterName.toLowerCase(configuration.getLocaleInstance()); cluster = OPaginatedClusterFactory .createCluster(clusterName, configuration.getVersion(), OPaginatedCluster.getLatestBinaryVersion(), this); cluster.configure(this, clusterPos, clusterName, parameters); } else { cluster = null; } int createdClusterId = -1; if (cluster != null) { cluster.create(-1); if (writeAheadLog != null) { writeAheadLog.flush(); } createdClusterId = registerCluster(cluster); ((OPaginatedCluster) cluster).registerInStorageConfig((OStorageConfigurationImpl) configuration); ((OStorageConfigurationImpl) configuration).update(); } if (OLogManager.instance().isDebugEnabled()) { OLogManager.instance() .debug(this, "Created cluster '%s' in database '%s' with id %d. Clusters: %s", clusterName, url, createdClusterId, clusters); } return createdClusterId; }
private OStorageOperationResult<Integer> doRecycleRecord(final ORecordId rid, final byte[] content, final int version, final OCluster cluster, final byte recordType) { try { makeStorageDirty(); boolean rollback = false; atomicOperationsManager.startAtomicOperation((String) null, true); try { cluster.recycleRecord(rid.getClusterPosition(), content, version, recordType); final ORecordSerializationContext context = ORecordSerializationContext.getContext(); if (context != null) { context.executeOperations(this); } } catch (final Exception e) { rollback = true; throw e; } finally { atomicOperationsManager.endAtomicOperation(rollback); } if (OLogManager.instance().isDebugEnabled()) { OLogManager.instance().debug(this, "Recycled record %s v.%s size=%d", rid, version, content.length); } return new OStorageOperationResult<>(version, content, false); } catch (final IOException ioe) { OLogManager.instance().error(this, "Error on recycling record " + rid + " (cluster: " + cluster + ")", ioe); throw OException .wrapException(new OStorageException("Error on recycling record " + rid + " (cluster: " + cluster + ")"), ioe); } }
if (OLogManager.instance().isDebugEnabled()) OLogManager.instance().debug(this, "Reused cached resultset size=%d", resultsetSize);