Tabnine Logo
org.apache.ignite.internal.util
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.ignite.internal.util

Best Java code snippets using org.apache.ignite.internal.util (Showing top 20 results out of 315)

origin: apache/ignite

/**
 * @param lock Lock address.
 */
public boolean tryWriteLock(long lock, int tag) {
  long state = GridUnsafe.getLongVolatile(null, lock);
  return checkTag(state, tag) && canWriteLock(state) &&
    GridUnsafe.compareAndSwapLong(null, lock, state, updateState(state, -1, 0, 0));
}
origin: apache/ignite

/**
 * @return Size of queue per stripe.
 */
public int[] stripesQueueSizes() {
  int[] res = new int[stripes()];
  for (int i = 0; i < res.length; i++)
    res[i] = stripes[i].queueSize();
  return res;
}
origin: apache/ignite

/**
 * Signal that update operation finished.
 */
public void endUpdate() {
  Sync<X> sync0 = sync;
  if (sync0.releaseAfterUpdate())
    takeSnapshotAndReplaceSync(sync0);
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testQueueSize() throws Exception {
  stripedExecSvc.execute(1, new TestRunnable());
  stripedExecSvc.execute(1, new TestRunnable(true));
  stripedExecSvc.execute(1, new TestRunnable(true));
  sleepASec();
  assertEquals(1, stripedExecSvc.queueSize());
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testCompletedTasks() throws Exception {
  stripedExecSvc.execute(0, new TestRunnable());
  stripedExecSvc.execute(1, new TestRunnable());
  sleepASec();
  assertEquals(2, stripedExecSvc.completedTasks());
}
origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testActiveStripesCount() throws Exception {
  stripedExecSvc.execute(0, new TestRunnable());
  stripedExecSvc.execute(1, new TestRunnable(true));
  sleepASec();
  assertEquals(1, stripedExecSvc.activeStripesCount());
}
origin: apache/ignite

/**
 * Removes stale references.
 */
private void removeStale() {
  PhantomReferenceElement<E> ref;
  while ((ref = (PhantomReferenceElement<E>) refQ.poll()) != null) {
    store.remove(ref);
    onGc(ref.get());
  }
}
origin: apache/ignite

/**
 * Removes stale references.
 */
private void removeStale() {
  WeakReferenceElement<E> ref;
  while ((ref = (WeakReferenceElement<E>) gcQ.poll()) != null) {
    store.remove(ref);
    onGc(ref.get());
  }
}
origin: apache/ignite

/** {@inheritDoc} */
@Override protected void writeIntFast(int val) {
  long off = GridUnsafe.BYTE_ARR_OFF + pos;
  if (BIG_ENDIAN)
    GridUnsafe.putIntLE(data, off, val);
  else
    GridUnsafe.putInt(data, off, val);
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public int size() {
  removeStale();
  return store.size();
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public int size() {
  removeStale();
  return store.size();
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean isEmpty() {
  removeStale();
  return store.isEmpty();
}
origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean isEmpty() {
  removeStale();
  return store.isEmpty();
}
origin: apache/ignite

/**
 * @return Consistent snapshot of data.
 */
public X snapshot() {
  Sync<X> sync0 = sync;
  if (sync0.flip())
    takeSnapshotAndReplaceSync(sync0);
  return  sync0.get();
}
origin: apache/ignite

/**
 * Execute command.
 *
 * @param idx Index.
 * @param cmd Command.
 */
public void execute(int idx, Runnable cmd) {
  if (idx == -1)
    execute(cmd);
  else {
    assert idx >= 0 : idx;
    stripes[idx % stripes.length].execute(cmd);
  }
}
origin: apache/ignite

/** {@inheritDoc} */
@Override protected long readLongFast() {
  long off = GridUnsafe.BYTE_ARR_OFF + pos;
  return BIG_ENDIAN ? GridUnsafe.getLongLE(data, off) : GridUnsafe.getLong(data, off);
}
origin: apache/ignite

/** {@inheritDoc} */
@Override protected void writeCharFast(char val) {
  long off = GridUnsafe.BYTE_ARR_OFF + pos;
  if (BIG_ENDIAN)
    GridUnsafe.putCharLE(data, off, val);
  else
    GridUnsafe.putChar(data, off, val);
}
origin: apache/ignite

/**
 * @param lock Lock to check.
 * @return {@code True} if write lock is held by any thread for the given offheap RW lock.
 */
public boolean isWriteLocked(long lock) {
  return lockCount(GridUnsafe.getLongVolatile(null, lock)) == -1;
}
origin: apache/ignite

/**
 * Creates a new instance with given concurrency level.
 *
 * @param concurrencyLvl Number of internal read locks.
 */
public StripedCompositeReadWriteLock(int concurrencyLvl) {
  locks = new ReadLock[concurrencyLvl];
  for (int i = 0; i < concurrencyLvl; i++)
    locks[i] = new ReadLock();
  writeLock = new WriteLock();
}
origin: apache/ignite

/**
 * @param lock Lock to check.
 * @return {@code True} if at least one read lock is held by any thread for the given offheap RW lock.
 */
public boolean isReadLocked(long lock) {
  return lockCount(GridUnsafe.getLongVolatile(null, lock)) > 0;
}
org.apache.ignite.internal.util

Most used classes

  • U
    Defines internal typedef for IgniteUtils. Since Java doesn't provide type aliases (like Scala, for e
  • S
    Defines internal typedef for GridToStringBuilder. Since Java doesn't provide type aliases (like Scal
  • F
    Defines alias for GridFunc by extending it. Since Java doesn't provide type aliases (like Scala, for
  • A
    Defines internal typedef for GridArgumentCheck. Since Java doesn't provide type aliases (like Scala,
  • X
    Defines global scope. Contains often used utility functions allowing to cut down on code bloat. This
  • G,
  • T2,
  • GridToStringInclude,
  • SB,
  • GridStringBuilder,
  • IgniteUtils,
  • GridUnsafe,
  • GridConcurrentHashSet,
  • CU,
  • LT,
  • GridLongList,
  • GridCompoundFuture,
  • GridFinishedFuture,
  • GridFutureAdapter
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now