/** * Return the type by ID. * * @param iId The id to search * * @return The type if any, otherwise null */ public static OType getById(final byte iId) { if (iId >= 0 && iId < TYPES_BY_ID.length) return TYPES_BY_ID[iId]; OLogManager.instance().warn(OType.class, "Invalid type index: " + iId, (Object[]) null); return null; }
public short readShort() throws IOException { updateMetricReceivedBytes(OBinaryProtocol.SIZE_SHORT); if (debug) { OLogManager.instance().info(this, "%s - Reading short (2 bytes)...", socket.getRemoteSocketAddress()); final short value = in.readShort(); OLogManager.instance().info(this, "%s - Read short: %d", socket.getRemoteSocketAddress(), value); return value; } return in.readShort(); }
@Override public void onDrop(final ODatabaseInternal db) { try { if (db.isClosed()) return; OLogManager.instance().debug(this, "Dropping Lucene indexes..."); db.getMetadata().getIndexManager().getIndexes().stream().filter(idx -> idx.getInternal() instanceof OLuceneFullTextIndex) .peek(idx -> OLogManager.instance().debug(this, "deleting index " + idx.getName())).forEach(idx -> idx.delete()); } catch (Exception e) { OLogManager.instance().warn(this, "Error on dropping Lucene indexes", e); } }
@Override public void onCompletition(final Object iTask, final boolean iSucceed) { final long idxSize = idx.getSize(); if (idxSize > 0) if (rebuild) OLogManager.instance().info(this, "--> OK, indexed %,d items in %,d ms", idxSize, (System.currentTimeMillis() - startTime)); else OLogManager.instance() .debug(this, "--> OK, indexed %,d items in %,d ms", idxSize, (System.currentTimeMillis() - startTime)); } }
public byte readByte() throws IOException { updateMetricReceivedBytes(OBinaryProtocol.SIZE_BYTE); if (debug) { OLogManager.instance().info(this, "%s - Reading byte (1 byte)...", socket.getRemoteSocketAddress()); final byte value = in.readByte(); OLogManager.instance().info(this, "%s - Read byte: %d", socket.getRemoteSocketAddress(), (int) value); return value; } return in.readByte(); }
@Override public void onDrop(final ODatabaseInternal iDatabase) { try { OLogManager.instance().debug(this, "Dropping Lucene indexes..."); for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) { if (idx.getInternal() instanceof OLuceneIndex) { OLogManager.instance().debug(this, "- index '%s'", idx.getName()); idx.delete(); } } } catch (Exception e) { OLogManager.instance().warn(this, "Error on dropping Lucene indexes", e); } }
@Override public void onBegin(final Object iTask, final long iTotal, final Object iRebuild) { startTime = System.currentTimeMillis(); lastDump = startTime; rebuild = (Boolean) iRebuild; if (iTotal > 0) if (rebuild) OLogManager.instance().info(this, "- Rebuilding index %s.%s (estimated %,d items)...", idx.getDatabaseName(), idx.getName(), iTotal); else OLogManager.instance().debug(this, "- Building index %s.%s (estimated %,d items)...", idx.getDatabaseName(), idx.getName(), iTotal); }
public void scheduleTask(final TimerTask task, final long delay, final long period) { engineLock.readLock().lock(); try { if (active) { if (period > 0) timer.schedule(task, delay, period); else timer.schedule(task, delay); } else OLogManager.instance().warn(this, "OrientDB engine is down. Task will not be scheduled."); } finally { engineLock.readLock().unlock(); } }
public short readShort() throws IOException { updateMetricReceivedBytes(OBinaryProtocol.SIZE_SHORT); if (debug) { OLogManager.instance().info(this, "%s - Reading short (2 bytes)...", socket.getRemoteSocketAddress()); final short value = in.readShort(); OLogManager.instance().info(this, "%s - Read short: %d", socket.getRemoteSocketAddress(), value); return value; } return in.readShort(); }
public Future<?> submit(final Runnable runnable) { engineLock.readLock().lock(); try { if (active) return workers.submit(runnable); else { OLogManager.instance().warn(this, "OrientDB engine is down. Task will not be submitted."); throw new IllegalStateException("OrientDB engine is down. Task will not be submitted."); } } finally { engineLock.readLock().unlock(); } }
private void evictStaleEntries() { int evicted = 0; Reference<? extends V> sv; while ((sv = refQueue.poll()) != null) { final K key = reverseLookup.remove(sv); if (key != null) { hashCodes.remove(key); evicted++; } } if (evicted > 0) OLogManager.instance().debug(this, "Evicted %d items", evicted); }
public boolean readBoolean() throws IOException { updateMetricReceivedBytes(OBinaryProtocol.SIZE_BYTE); if (debug) { OLogManager.instance().info(this, "%s - Reading boolean (1 byte)...", socket.getRemoteSocketAddress()); final boolean value = in.readBoolean(); OLogManager.instance().info(this, "%s - Read boolean: %b", socket.getRemoteSocketAddress(), value); return value; } return in.readBoolean(); }