Tabnine Logo
V8Locker.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.eclipsesource.v8.V8Locker
constructor

Best Java code snippets using com.eclipsesource.v8.V8Locker.<init> (Showing top 16 results out of 315)

origin: eclipsesource/J2V8

protected V8(final String globalAlias) {
  super(null);
  released = false;
  v8RuntimePtr = _createIsolate(globalAlias);
  locker = new V8Locker(this);
  checkThread();
  objectHandle = _getGlobalObject(v8RuntimePtr);
}
origin: eclipsesource/J2V8

protected V8(final String globalAlias) {
  super(null);
  released = false;
  v8RuntimePtr = _createIsolate(globalAlias);
  locker = new V8Locker(this);
  checkThread();
  objectHandle = _getGlobalObject(v8RuntimePtr);
}
origin: eclipsesource/J2V8

@Test
public void testThreadLocked_tryAcquire() throws InterruptedException {
  final V8Locker v8Locker = new V8Locker(v8);
  final boolean result[] = new boolean[1];
  Thread t = new Thread(new Runnable() {
    @Override
    public void run() {
      result[0] = v8Locker.tryAcquire();
    }
  });
  t.start();
  t.join();
  assertFalse(result[0]);
}
origin: eclipsesource/J2V8

@Test
public void testThreadLocked() throws InterruptedException {
  final V8Locker v8Locker = new V8Locker(v8);
  passed = false;
  Thread t = new Thread(new Runnable() {
    @Override
    public void run() {
      try {
        v8Locker.checkThread();
      } catch (Error e) {
        assertTrue(e.getMessage().startsWith("Invalid V8 thread access"));
        passed = true;
      }
    }
  });
  t.start();
  t.join();
  assertTrue(passed);
}
origin: eclipsesource/J2V8

@Test
public void testAcquireOnCreation() {
  V8Locker v8Locker = new V8Locker(v8);
  v8Locker.checkThread();
}
origin: eclipsesource/J2V8

@Test
public void testGetThread() {
  V8Locker v8Locker = new V8Locker(v8);
  assertEquals(Thread.currentThread(), v8Locker.getThread());
}
origin: eclipsesource/J2V8

@Test
public void testCannotUseReleasedLocker() {
  V8Locker v8Locker = new V8Locker(v8);
  v8Locker.release();
  try {
    v8Locker.checkThread();
  } catch (Error e) {
    assertTrue(e.getMessage().startsWith("Invalid V8 thread access"));
    return;
  }
  fail("Expected exception");
}
origin: eclipsesource/J2V8

@Test
public void testHasLock() {
  V8Locker v8Locker = new V8Locker(v8);
  assertTrue(v8Locker.hasLock());
}
origin: eclipsesource/J2V8

@Test
public void testAcquireLocker() {
  V8Locker v8Locker = new V8Locker(v8);
  v8Locker.release();
  v8Locker.acquire();
  v8Locker.checkThread();
}
origin: eclipsesource/J2V8

@Test
public void testMultipleRelease() {
  V8Locker v8Locker = new V8Locker(v8);
  v8Locker.release();
  v8Locker.release();
  v8Locker.release();
}
origin: eclipsesource/J2V8

@Test
public void testReleaseAfterV8Released() {
  V8Locker v8Locker = new V8Locker(v8);
  v8.close();
  v8Locker.release();
  v8 = V8.createV8Runtime(); // Create a new runtime so the teardown doesn't fail
}
origin: eclipsesource/J2V8

@Test
public void testDoesNotHasLock() {
  V8Locker v8Locker = new V8Locker(v8);
  v8Locker.release();
  assertFalse(v8Locker.hasLock());
}
origin: eclipsesource/J2V8

@Test
public void testGetThreadNullAfterRelease() {
  V8Locker v8Locker = new V8Locker(v8);
  v8Locker.release();
  assertNull(v8Locker.getThread());
}
origin: eclipsesource/J2V8

@Test
public void testTryAcquireLocker_True() {
  V8Locker v8Locker = new V8Locker(v8);
  v8Locker.release();
  boolean result = v8Locker.tryAcquire();
  assertTrue(result);
  v8Locker.checkThread();
}
origin: com.eclipsesource.j2v8/j2v8_win32_x86_64

protected V8(final String globalAlias) {
  super(null);
  released = false;
  locker = new V8Locker();
  checkThread();
  v8RuntimePtr = _createIsolate(globalAlias);
  objectHandle = _getGlobalObject(v8RuntimePtr);
}
origin: com.eclipsesource.j2v8/j2v8_macosx_x86_64

protected V8(final String globalAlias) {
  super(null);
  released = false;
  locker = new V8Locker();
  checkThread();
  v8RuntimePtr = _createIsolate(globalAlias);
  objectHandle = _getGlobalObject(v8RuntimePtr);
}
com.eclipsesource.v8V8Locker<init>

Popular methods of V8Locker

  • acquire
    Acquire the lock if it's currently not acquired by another thread. If it's current held by another t
  • checkThread
    Checks if the locker has access to the current thread. If the locker holds a different thread, than
  • hasLock
    Check if the current thread holds this lock.
  • release
    Release the lock if it's currently held by the calling thread. If the current thread does not hold t
  • getThread
    Returns the current thread associated with locker.
  • tryAcquire
    Acquire the lock if it's currently not acquired by another thread. If it's currently held by another

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • CodeWhisperer alternatives
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