Tabnine Logo
BlockerSync.awaitBlocker
Code IndexAdd Tabnine to your IDE (free)

How to use
awaitBlocker
method
in
org.apache.flink.core.testutils.BlockerSync

Best Java code snippets using org.apache.flink.core.testutils.BlockerSync.awaitBlocker (Showing top 3 results out of 315)

origin: apache/flink

@Before
public void setUp() throws Exception {
  jobExecuteThread = new CheckedThread() {
    @Override
    public void go() throws Exception {
      StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
      env.addSource(new SourceFunction<String>() {
        @Override
        public void run(SourceContext<String> ctx) throws Exception {
          sync.block();
        }
        @Override
        public void cancel() {
          sync.releaseBlocker();
        }
      }).addSink(new PrintSinkFunction());
      env.execute();
    }
  };
  jobExecuteThread.start();
  sync.awaitBlocker();
}
origin: apache/flink

@Test
public void testConcurrentUseOfSerializer() throws Exception {
  final AvroSerializer<String> serializer = new AvroSerializer<>(String.class);
  final BlockerSync sync = new BlockerSync();
  final DataOutputView regularOut = new DataOutputSerializer(32);
  final DataOutputView lockingOut = new LockingView(sync);
  // this thread serializes and gets stuck there
  final CheckedThread thread = new CheckedThread("serializer") {
    @Override
    public void go() throws Exception {
      serializer.serialize("a value", lockingOut);
    }
  };
  thread.start();
  sync.awaitBlocker();
  // this should fail with an exception
  try {
    serializer.serialize("value", regularOut);
    fail("should have failed with an exception");
  }
  catch (IllegalStateException e) {
    // expected
  }
  finally {
    // release the thread that serializes
    sync.releaseBlocker();
  }
  // this propagates exceptions from the spawned thread
  thread.sync();
}
origin: apache/flink

@Test
public void testConcurrentUseOfSerializer() throws Exception {
  final KryoSerializer<String> serializer = new KryoSerializer<>(String.class, new ExecutionConfig());
  final BlockerSync sync = new BlockerSync();
  final DataOutputView regularOut = new DataOutputSerializer(32);
  final DataOutputView lockingOut = new LockingView(sync);
  // this thread serializes and gets stuck there
  final CheckedThread thread = new CheckedThread("serializer") {
    @Override
    public void go() throws Exception {
      serializer.serialize("a value", lockingOut);
    }
  };
  thread.start();
  sync.awaitBlocker();
  // this should fail with an exception
  try {
    serializer.serialize("value", regularOut);
    fail("should have failed with an exception");
  }
  catch (IllegalStateException e) {
    // expected
  }
  finally {
    // release the thread that serializes
    sync.releaseBlocker();
  }
  // this propagates exceptions from the spawned thread
  thread.sync();
}
org.apache.flink.core.testutilsBlockerSyncawaitBlocker

Javadoc

Waits until the blocking thread has entered the method #block()or #blockNonInterruptible().

Popular methods of BlockerSync

  • releaseBlocker
    Lets the blocked thread continue.
  • <init>
  • blockNonInterruptible
    Blocks until #releaseBlocker() is called. Notifies the awaiting thread that waits in the method #awa

Popular in Java

  • Start an intent from android
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Join (org.hibernate.mapping)
  • Top PhpStorm plugins
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