public void serve(Socket s) { try { doService(s); synchronized (this) { notify(); } s.close(); } catch (IOException e) { e.printStackTrace(); } }
public synchronized void publish(LogRecord record) { if (!record.getMessage().startsWith("cnt")) { return; } boolean snd = Thread.currentThread().getName().equals("2nd"); if (runSecond == snd) { notify(); runSecond = !runSecond; } try { wait(500); } catch (InterruptedException ex) { } }
public void run() { try { Transaction txn = mDb.newTransaction(); if (mNoGhost) { mIx.lockExclusive(txn, mKey); mIx.store(Transaction.BOGUS, mKey, mValue); } else { mIx.store(txn, mKey, mValue); } synchronized (this) { mSleeping = true; notify(); } Thread.sleep(500); txn.commit(); } catch (Exception e) { } }