下面列出了java.lang.InterruptedException#java.lang.Thread 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Test public void alwaysQualifySupersedesJavaLangImports() {
String source = JavaFile.builder("com.squareup.tacos",
TypeSpec.classBuilder("Taco")
.addField(Thread.class, "thread")
.alwaysQualify("Thread")
.build())
.skipJavaLangImports(true)
.build()
.toString();
assertThat(source).isEqualTo(""
+ "package com.squareup.tacos;\n"
+ "\n"
+ "class Taco {\n"
+ " java.lang.Thread thread;\n"
+ "}\n");
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
@Override
// close the bot processes, save, exit program
public void finish() throws Exception
{
for(Player player : players) {
player.getBot().finish();
}
Thread.sleep(100);
// write everything
try {
this.saveGame();
} catch(Exception e) {
e.printStackTrace();
}
System.out.println("Done.");
System.exit(0);
}
/**
* close the bot processes, save, exit program
*/
@Override
public void finish() throws Exception
{
this.player1.getBot().finish();
this.player2.getBot().finish();
Thread.sleep(100);
// write everything
try {
this.saveGame();
} catch(Exception e) {
e.printStackTrace();
}
System.out.println("Done.");
System.exit(0);
}
public static void main(String[] args) throws Exception {
DisplayChangeVITest test = new DisplayChangeVITest();
GraphicsDevice gd =
GraphicsEnvironment.getLocalGraphicsEnvironment().
getDefaultScreenDevice();
if (gd.isFullScreenSupported()) {
gd.setFullScreenWindow(test);
Thread t = new Thread(test);
t.run();
synchronized (lock) {
while (!done) {
try {
lock.wait(50);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
System.err.println("Test Passed.");
} else {
System.err.println("Full screen not supported. Test passed.");
}
}
public void run() {
_model.setStatus("Started");
_model.setStopping(false);
_runThread = Thread.currentThread();
_model.setRunning(true);
while (!_model.isStopping()) {
// queue them as fast as they come, sleep a bit otherwise
if (!queueRequests()) {
try {
Thread.sleep(100);
} catch (InterruptedException ie) {}
} else {
Thread.yield();
}
}
_fetcherQueue.clearRequestQueue();
_model.setRunning(false);
_runThread = null;
_model.setStatus("Stopped");
}
/**
* Instantiates ingest thread for the given edits file type
*
* @param type (EDITS, EDITS_NEW)
*/
private void instantiateIngest(IngestFile type)
throws IOException {
File edits;
InjectionHandler.processEvent(InjectionEvent.STANDBY_INSTANTIATE_INGEST);
synchronized (ingestStateLock) {
assertState(StandbyIngestState.NOT_INGESTING);
edits = getIngestFile(type);
// if the file does not exist,
// do not change the state
if (!edits.exists()
|| InjectionHandler
.falseCondition(InjectionEvent.STANDBY_EDITS_NOT_EXISTS, type)) {
return;
}
setCurrentIngestFile(edits);
ingest = new Ingest(this, fsnamesys, confg, edits);
ingestThread = new Thread(ingest);
ingestThread.start();
currentIngestState = type == IngestFile.EDITS
? StandbyIngestState.INGESTING_EDITS
: StandbyIngestState.INGESTING_EDITS_NEW;
}
LOG.info("Standby: Instantiated ingest for edits file: " + edits.getName());
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
@Test public void alwaysQualifySimple() {
String source = JavaFile.builder("com.squareup.tacos",
TypeSpec.classBuilder("Taco")
.addField(Thread.class, "thread")
.alwaysQualify("Thread")
.build())
.build()
.toString();
assertThat(source).isEqualTo(""
+ "package com.squareup.tacos;\n"
+ "\n"
+ "class Taco {\n"
+ " java.lang.Thread thread;\n"
+ "}\n");
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
public void compute(ITime targetTime) {
block();
ThreadStochModelAdmin admin = (ThreadStochModelAdmin) threadAdmins.get(factoryID);
threadID=admin.waitUntilFreeThread();
threadModelCompute = new ThreadStochModelCompute(threadModel, targetTime);
threadModelCompute.start();
admin.setThread(threadID, (Thread) threadModelCompute);
// Start Thread for the getState method
if (cashState){
this.threadModelGetState = new ThreadStochModelGetState(threadModel, threadModelCompute);
this.threadModelGetState.start();
}
}
static NgramScorer getWordsLM() throws IOException {
NgramScorer retval = lmMap.get(Thread.currentThread());
if (retval != null) {
lmMap.remove(Thread.currentThread());
return retval;
}
return new StandardNgramModel(3, wordsLM());
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
public static void main(String[] args) {
System.gc();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
}
}
public void run() {
bIsAlive = true;
while(bRun && !isBroken()) {
updateProgress(-1);
try {
Thread.sleep(delay);
} catch (Exception e) { }
}
bIsAlive = false;
runner = null;
}
public void end() {
mStop = true;
// waiting loop, it waits until the thread actually finishes
while(!mStopped) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
};
}
public void waitDelaysFinish() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}