Example usage for java.lang InterruptedException printStackTrace

List of usage examples for java.lang InterruptedException printStackTrace

Introduction

In this page you can find the example usage for java.lang InterruptedException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:ImageFrame.java

/**
 * Set the image from a file.//from   w  ww. java  2 s . c o m
 */
public void setImage(File file) throws IOException {
    // load the image
    Image image = getToolkit().getImage(file.getAbsolutePath());

    // wait for the image to entirely load
    MediaTracker tracker = new MediaTracker(this);
    tracker.addImage(image, 0);
    try {
        tracker.waitForID(0);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    if (tracker.statusID(0, true) != MediaTracker.COMPLETE) {
        throw new IOException("Could not load: " + file + " " + tracker.statusID(0, true));
    }

    setTitle(file.getName());
    setImage(image);
}

From source file:MainClass.java

public void init() {
    MediaTracker mt = new MediaTracker(this);
    i = getImage(getDocumentBase(), "ora-icon.gif");
    mt.addImage(i, 0);/*from  ww w . j  a  v  a2  s.  c om*/
    try {
        mt.waitForAll();
        int width = i.getWidth(this);
        int height = i.getHeight(this);
        int pixels[] = new int[width * height];
        PixelGrabber pg = new PixelGrabber(i, 0, 0, width, height, pixels, 0, width);
        if (pg.grabPixels() && ((pg.status() & ImageObserver.ALLBITS) != 0)) {
            j = createImage(
                    new MemoryImageSource(width, height, rowFlipPixels(pixels, width, height), 0, width));
            k = createImage(
                    new MemoryImageSource(width, height, colFlipPixels(pixels, width, height), 0, width));
            l = createImage(
                    new MemoryImageSource(height, width, rot90Pixels(pixels, width, height), 0, height));
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:SynchronizedQueue.java

public void flush(PrintWriter out, QueueObjectSerializer<T> serializer, boolean hold) {
    synchronized (this) {
        T t;//from  ww w .  j  ava  2s  .c  o  m
        if (hold && this.isEmpty()) {
            try {
                messages.wait(5000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
        }
        while ((t = messages.poll()) != null) {
            serializer.serialize(out, t);
        }
    }
}

From source file:com.wabacus.system.dataimport.queue.UploadFilesQueue.java

public List<Map<List<DataImportItem>, Map<File, FileItem>>> getLstAllUploadFiles() {
    synchronized (queueInstance) {
        while (queueInstance.size() == 0) {
            try {
                queueInstance.wait();//  ww  w  .j  ava  2 s .  c  o m
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        List<Map<List<DataImportItem>, Map<File, FileItem>>> lstResults = new ArrayList<Map<List<DataImportItem>, Map<File, FileItem>>>();
        lstResults.addAll(queueInstance);
        queueInstance.clear();
        return lstResults;
    }
}

From source file:io.pcp.parfait.benchmark.CPUThreadTest.java

private void awaitExecutionCompletion(ExecutorService executorService) {
    try {/*from w ww .j  av  a  2  s. c o m*/
        executorService.shutdown();
        executorService.awaitTermination(1, TimeUnit.MINUTES);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:com.thoughtworks.go.agent.bootstrapper.AgentBootstrapper.java

void waitForRelaunchTime() {
    LOG.info("Waiting for {} ms before re-launch....", waitTimeBeforeRelaunch);
    try {/* w w  w .  jav  a2 s.co m*/
        Thread.sleep(waitTimeBeforeRelaunch);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:org.terasoluna.gfw.functionaltest.app.DBLogProvider.java

public void waitForAssertion() {
    try {// w w  w .j  a v a2s . c om
        Thread.sleep(50);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:org.terasoluna.gfw.functionaltest.app.DBLogProvider.java

public void waitForAssertion(long waitTime) {
    try {/*from   w w w. j a  v  a  2 s . com*/
        Thread.sleep(waitTime);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:com.taobao.tanggong.H2ServerTest.java

@Test
public void test() {
    H2Server h = (H2Server) this.appContext.getBean("h2Server");

    DataSource dataSource = (DataSource) this.appContext.getBean("dataSource");
    try {//from   w w w.jav a2 s .  c  o  m
        Assert.assertNotNull(dataSource.getConnection());
    } catch (SQLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    try {
        Thread.sleep(1000000l);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:io.fabric8.example.calculator.http.CalculatorHTTP.java

private void sleep(int time) {
    try {/*  ww w . ja  va2  s. c  o m*/
        Thread.sleep(time);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}