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:com.web.searchlocal.flashpaper.thread.Covnert2SwfTask.java

/** 
 * //from  w  w  w. j  a va  2s  .  com
 */
public void run() {
    while (true) {
        synchronized (this) {
            excute();
        }
        try {
            System.out.println("");
            sleep(1 * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

From source file:cqels_shim.StdinStream.java

/**
 * start listening to stdin and forwarding to cqels
 *//*from   w ww. j  av  a  2 s.com*/
public void run() {
    try {
        JSONParser parser = new JSONParser();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line;

        while ((line = reader.readLine()) != null && !stop) {
            try {
                Object obj = parser.parse(line);
                JSONArray array = (JSONArray) obj;

                //stream the triple
                stream(n((String) array.get(0)), n((String) array.get(1)), n((String) array.get(2)));
            } catch (ParseException pe) {
                System.err.println("Error when parsing input, incorrect JSON.");
            }

            if (sleep > 0) {
                try {
                    Thread.sleep(sleep);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:jenkins.plugins.pbs.DisplayPBSJobAction.java

public void doIndex(StaplerRequest request, StaplerResponse response) throws ServletException, IOException {
    String jobId = request.getParameter("jobId");
    String sNumberOfDays = request.getParameter("numberOfDays");
    int numberOfDays = 1;
    if (StringUtils.isNotBlank(sNumberOfDays)) {
        numberOfDays = Integer.parseInt(sNumberOfDays);
    } else {//from  ww  w. j  a v a2  s  .  c om
        PBSBuilderDescriptor descriptor = (PBSBuilderDescriptor) Jenkins.getInstance()
                .getDescriptor(PBSBuilder.class);
        numberOfDays = descriptor.getNumberOfDays();
    }
    String slaveName = request.getParameter("slaveName");

    Computer computer = Jenkins.getInstance().getComputer(slaveName);
    if (!(computer instanceof PBSSlaveComputer)) {
        throw new RuntimeException(String.format("%s is not a PBS Slave!", computer.getName()));
    }
    PBSSlaveComputer pbsSlaveComputer = (PBSSlaveComputer) computer;

    TraceJob traceJob = new TraceJob(jobId, numberOfDays);

    PBSJob pbsJob = null;
    try {
        pbsJob = pbsSlaveComputer.getChannel().call(traceJob);

        request.setAttribute("output", pbsJob.getOut());
        request.setAttribute("error", pbsJob.getErr());
        request.getView(this, "index.jelly").forward(request, response);
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (Throwable e) {
        e.printStackTrace();
    }
}

From source file:cloud.thrift.client.config.ZooKeeperConfig.java

@PostConstruct
private void init() {
    executor.execute(new Runnable() {
        @Override/*w  ww  .j  av  a 2  s  .  co m*/
        public void run() {
            startZooKeeper();
            try {
                Thread.sleep(1000 * 60 * 60 * 24 * 360 * 10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:ru.trett.cis.DAO.CommonDAOImpl.java

@Override
public void buildIndices() {
    FullTextSession fullTextSession = Search.getFullTextSession(sessionFactory.getCurrentSession());
    try {//from  w  w  w .  j a  v a  2 s .  c  om
        fullTextSession.createIndexer().startAndWait();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:boot.dubbo.normal.client.DemoConsumer.java

@Test
public void test() {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
            new String[] { "classpath:/META-INF/spring/applicationContext-dubbo.xml" });
    ctx.start();// www  .j av a  2 s  . c  o  m

    System.out.println(ctx.getStartupDate());
    UserService userService = ctx.getBean("userService", UserService.class);
    while (true) {
        List<User> users = userService.findAll();
        User u = new User();
        Random r = new Random();
        u.setName("gsadg" + r.nextInt());
        String v = userService.create(u);
        System.out.println("" + v + "size:" + users.size());
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    // try {
    // System.in.read();
    // } catch (IOException e) {
    // e.printStackTrace();
    // }
}