Last active
August 29, 2015 13:59
-
-
Save minisu/10717629 to your computer and use it in GitHub Desktop.
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
| private Long myNtfSeqNbrCounter = new Long(0); | |
| private Long getNotificationSequenceNumber() { | |
| Long result = null; | |
| synchronized(myNtfSeqNbrCounter) { | |
| result = new Long(myNtfSeqNbrCounter.longValue() + 1); | |
| // ... | |
| myNtfSeqNbrCounter = new Long(result.longValue()); | |
| // ... | |
| return result; | |
| } | |
| } | |
| ////////////////////////////////////////////////////// | |
| private Long myNtfSeqNbrCounter = new Long(0); | |
| private Long getNotificationSequenceNumber() { | |
| Long result = null; | |
| synchronized(this) { | |
| result = new Long(myNtfSeqNbrCounter.longValue() + 1); | |
| // ... | |
| myNtfSeqNbrCounter = new Long(result.longValue()); | |
| // ... | |
| return result; | |
| } | |
| } | |
| ////////////////////////////////////////////////////// | |
| private String myNtfSeqNbrLock = "lock"; | |
| private Long myNtfSeqNbrCounter = new Long(0); | |
| private Long getNotificationSequenceNumber() { | |
| Long result = null; | |
| synchronized(myNtfSeqNbrLock) { | |
| result = new Long(myNtfSeqNbrCounter.longValue() + 1); | |
| // ... | |
| myNtfSeqNbrCounter = new Long(result.longValue()); | |
| // ... | |
| return result; | |
| } | |
| } | |
| ////////////////////////////////////////////////////// | |
| private Object myNtfSeqNbrLock = new Object(); | |
| private Long myNtfSeqNbrCounter = new Long(0); | |
| private Long getNotificationSequenceNumber() { | |
| Long result = null; | |
| synchronized(myNtfSeqNbrLock) { | |
| result = new Long(myNtfSeqNbrCounter.longValue() + 1); | |
| // ... | |
| myNtfSeqNbrCounter = new Long(result.longValue()); | |
| // ... | |
| return result; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment