List of usage examples for java.lang InterruptedException InterruptedException
public InterruptedException()
InterruptedException
with no detail message. From source file:net.minecraftforge.fml.client.FMLClientHandler.java
@Override public void queryUser(StartupQuery query) throws InterruptedException { if (query.getResult() == null) { client.displayGuiScreen(new GuiNotification(query)); } else {//w w w. j a v a 2 s . com client.displayGuiScreen(new GuiConfirmation(query)); } if (query.isSynchronous()) { while (client.currentScreen instanceof GuiNotification) { if (Thread.interrupted()) throw new InterruptedException(); client.loadingScreen.displayLoadingString(""); Thread.sleep(50); } client.loadingScreen.displayLoadingString(""); // make sure the blank screen is being drawn at the end } }
From source file:LinkedTransferQueue.java
public void put(E e) throws InterruptedException { if (e == null) { throw new NullPointerException(); }//from www. j a v a 2 s. c om if (Thread.interrupted()) { throw new InterruptedException(); } xfer(e, NOWAIT, 0); }
From source file:LinkedTransferQueue.java
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { if (e == null) { throw new NullPointerException(); }/*from www . j av a2 s .c o m*/ if (Thread.interrupted()) { throw new InterruptedException(); } xfer(e, NOWAIT, 0); return true; }
From source file:com.aol.advertising.qiao.injector.file.AbstractFileTailer.java
protected long checksumWaitQuietlyIfFileNotExist(File file) throws IOException, InterruptedException { RandomAccessFile raf = openFileQuietly(file); if (raf == null) throw new InterruptedException(); // was interrupted try {// w w w.j ava 2 s . c o m long v = checksum(raf); return v; } finally { IOUtils.closeQuietly(raf); } }
From source file:com.trellmor.berrymotes.sync.SubredditEmoteDownloader.java
private void checkInterrupted() throws InterruptedException { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); }/*from ww w. ja v a 2s .c o m*/ }
From source file:LinkedTransferQueue.java
public void transfer(E e) throws InterruptedException { if (e == null) { throw new NullPointerException(); }//from w w w.ja v a 2s . c o m if (xfer(e, WAIT, 0) == null) { Thread.interrupted(); throw new InterruptedException(); } }
From source file:com.yahoo.ads.pb.kafka.KafkaSimpleConsumer.java
public long getLastOffset() throws InterruptedException { OffsetResponse response = null;// ww w.j a v a 2 s.c o m Broker previousLeader = leaderBroker; while (true) { TopicAndPartition topicAndPartition = new TopicAndPartition(topic, partitionId); Map<TopicAndPartition, PartitionOffsetRequestInfo> requestInfo = new HashMap<TopicAndPartition, PartitionOffsetRequestInfo>(); requestInfo.put(topicAndPartition, new PartitionOffsetRequestInfo(kafka.api.OffsetRequest.LatestTime(), 1)); kafka.javaapi.OffsetRequest request = new kafka.javaapi.OffsetRequest(requestInfo, kafka.api.OffsetRequest.CurrentVersion(), clientId); ensureConsumer(previousLeader); try { response = consumer.getOffsetsBefore(request); } catch (Exception e) { // e could be an instance of ClosedByInterruptException as SimpleConsumer.fetch uses nio if (Thread.interrupted()) { logger.info("catch exception of {} with interrupted in getLastOffset for {} - {}", e.getClass().getName(), topic, partitionId); throw new InterruptedException(); } logger.warn("caughte exception in getLastOffset {} - {}", topic, partitionId, e); response = null; } if (response == null || response.hasError()) { short errorCode = response != null ? response.errorCode(topic, partitionId) : ErrorMapping.UnknownCode(); logger.warn("Error fetching data Offset for {} - {}, the Broker. Reason: {}", topic, partitionId, errorCode); stopConsumer(); previousLeader = leaderBroker; leaderBroker = null; continue; } break; } long[] offsets = response.offsets(topic, partitionId); return offsets[offsets.length - 1]; }
From source file:com.evolveum.midpoint.task.quartzimpl.work.WorkStateManager.java
private void dynamicSleep(long delay, Supplier<Boolean> canRunSupplier) throws InterruptedException { while (delay > 0) { if (!canRun(canRunSupplier)) { throw new InterruptedException(); }// w w w . jav a 2 s. c o m Thread.sleep(Math.min(delay, DYNAMIC_SLEEP_INTERVAL)); delay -= DYNAMIC_SLEEP_INTERVAL; } }
From source file:LinkedTransferQueue.java
public boolean tryTransfer(E e, long timeout, TimeUnit unit) throws InterruptedException { if (e == null) { throw new NullPointerException(); }/*from www .j a va 2 s . c o m*/ if (xfer(e, TIMEOUT, unit.toNanos(timeout)) != null) { return true; } if (!Thread.interrupted()) { return false; } throw new InterruptedException(); }
From source file:free.yhc.netmbuddy.utils.Utils.java
public static void copy(OutputStream os, InputStream is) throws IOException, InterruptedException { byte buf[] = new byte[1024 * 16]; int len;/*from ww w . j a v a2 s .co m*/ while ((len = is.read(buf)) > 0) { if (Thread.currentThread().isInterrupted()) throw new InterruptedException(); os.write(buf, 0, len); } }