This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| final Handler handler = new Handler(hThread.getLooper()); | |
| final long oneMinuteMs = 60 * 1000; | |
| Runnable eachMinute = new Runnable() { | |
| @Override | |
| public void run() { | |
| Log.d(TAG, "Each minute task executing"); | |
| handler.postDelayed(this, oneMinuteMs); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HandlerThread hThread = new HandlerThread("HandlerThread"); | |
| hThread.start(); | |
| Handler handler = new Handler(hThread.getLooper()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public final boolean sendMessageDelayed(Message msg, long delayMillis) { | |
| if (delayMillis < 0) { | |
| delayMillis = 0; | |
| } | |
| return sendMessageAtTime(msg, SystemClock.uptimeMillis() + delayMillis); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.binarybuffer.test.bufferbuilder; | |
| import org.apache.commons.math3.stat.descriptive.StatisticalSummary; | |
| import org.apache.commons.math3.stat.descriptive.SummaryStatistics; | |
| import org.junit.Test; | |
| /** | |
| * Unit test for simple App. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| message query { | |
| required string request = 1; | |
| optional int64 limit = 2 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // msg contains Parsed Query protobuf message | |
| String query = msg.getQuery(); | |
| Long limit = msg.getLimit(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Long limit = msg.hasLimit() ? msg.getLimit() : null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def message = Message.lock(messageId) | |
| processMessage(message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.hibernate.LockMode | |
| // Some code skipped | |
| Message.withTransaction { | |
| try { | |
| def msg = Message.withCriteria { | |
| eq "id", Long.valueOf(messageId) | |
| delegate.criteria.lockMode = LockMode.UPGRADE_NOWAIT | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.binarybuffer.postgres; | |
| import org.hibernate.LockMode; | |
| import org.hibernate.dialect.PostgreSQLDialect; | |
| /** | |
| * Simple extension to standard {@link PostgreSQLDialect} adding support for | |
| * {@link LockMode#UPGRADE_NOWAIT} lock mode which is achieved using | |
| * "FOR UPDATE NOWAIT" syntax in PostgreSQL | |
| * |
OlderNewer