How to unify the Date(Timeline) in different threads?
up vote
-2
down vote
favorite
A Customer Generator Thread:
public class CustomerGeneratorThread implements Runnable {
private BlockingQueue<Customer> customerList;
public CustomerGeneratorThread(BlockingQueue<Customer> customerList){
this.customerList = customerList;
}
@Override
public void run() {
while(true){
//generate a new customer
Customer customer = new Customer();
customer.setArrivedTime(new Date(Sysmtem.currentTimeMillis()));
customer.setTimeOfCheckout(Math.random()*1000)
customerList.offer(customer);
}
}
}
An assigning Generator Thread:
public class AssigningThread implements Runnable {
private ArrayList<Queue<Customer>> customerWaitingLists;
private BlockingQueue<Customer> customerList;
private int numOfCheckout;
public AssigningThread(ArrayList<Queue<Customer>> customerWaitingLists, BlockingQueue<Customer> customerList, int numOfCheckout) {
this.customerWaitingLists = customerWaitingLists;
this.customerList = customerList;
this.numOfCheckout = numOfCheckout;
}
@Override
public void run() {
while (true) {
try {
Customer customerToken = customerList.take();
synchronized (customerWaitingLists) {
for (int i = 0; i < numOfCheckout; i++) {
Queue<Customer> q = customerWaitingLists.get(i);
if (q.size() < 6) {
q.offer(customerToken);
}
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
Several Checkout Threads:
public class CheckoutThread implements Runnable {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
public CheckoutThread(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
}
@Override
public void run() {
while (true) {
Customer customerPolled;
synchronized (customerWaitingLists) {
customerPolled = (Customer) customerWaitingLists.get(numOfCheckout).poll();
customerPolled.setCheckStartTime(new Date(System.currentTimeMillis()));
Integer timeOfCheckout = customerPolled.getTimeOfCheckout();
try {
Thread.sleep(timeOfCheckout);
} catch (InterruptedException e) {
e.printStackTrace();
}
customerPolled.setCheckEndTime(new Date(System.currentTimeMillis()));
}
synchronized(customerCheckedList){
customerCheckedList.add(customerPolled);
}
}
}
}
The Customer class:
public class Customer {
private Date arrivedTime;
private Integer timeOfCheckout;
private Date checkStartTime;
private Date checkEndTime;
public Date getArrivedTime() {
return arrivedTime;
}
public void setArrivedTime(Date arrivedTime) {
this.arrivedTime = arrivedTime;
}
public Integer getTimeOfCheckout() {
return timeOfCheckout;
}
public void setTimeOfCheckout(Integer timeOfCheckout) {
this.timeOfCheckout = timeOfCheckout;
}
public Date getCheckStartTime() {
return checkStartTime;
}
public void setCheckStartTime(Date checkStartTime) {
this.checkStartTime = checkStartTime;
}
public Date getCheckEndTime() {
return checkEndTime;
}
public void setCheckEndTime(Date checkEndTime) {
this.checkEndTime = checkEndTime;
}
}
The main thread:
public class MainApp {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
private BlockingQueue<Customer> customerList;
public MainApp(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList, BlockingQueue<Customer> customerList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
this.customerList = customerList;
test();
}
public void test() {
CustomerGeneratorThread cgt = new CustomerGeneratorThread(customerList);
new Thread(cgt).start();
AssigningThread at = new AssigningThread(customerWaitingLists, customerList, numOfCheckout);
new Thread(at).start();
for (int i = 0; i < numOfCheckout; i++) {
CheckoutThread ct = new CheckoutThread(numOfCheckout, customerWaitingLists, customerCheckedList);
new Thread(ct).start();
}
//sleep for 20s ,then, get wait time of each customer
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
synchronized (customerCheckedList) {
for (int i = 0; i < customerCheckedList.size(); i++) {
Customer c = customerCheckedList.get(i);
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
System.out.println((waitTime / 1000) + " sec");
}
}
}
public static void main(String args) {
MainApp mainApp = new MainApp(5, new ArrayList<Queue<Customer>>(), new ArrayList<Customer>(), new ArrayBlockingQueue());
}
}
Here is the problem:
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
The waitTime sometimes was assigned to a negative number which confused me.
A customer follows the sequence like this:
CustomerGeneratorThread(setArrivedTime) -> AssigningThread -> CheckoutThread(setCheckStartTime).
At this situation, the waitTime shouldn't be a negative number.
So, how to fix this problem?
Thanks in advance.
java multithreading date time
|
show 4 more comments
up vote
-2
down vote
favorite
A Customer Generator Thread:
public class CustomerGeneratorThread implements Runnable {
private BlockingQueue<Customer> customerList;
public CustomerGeneratorThread(BlockingQueue<Customer> customerList){
this.customerList = customerList;
}
@Override
public void run() {
while(true){
//generate a new customer
Customer customer = new Customer();
customer.setArrivedTime(new Date(Sysmtem.currentTimeMillis()));
customer.setTimeOfCheckout(Math.random()*1000)
customerList.offer(customer);
}
}
}
An assigning Generator Thread:
public class AssigningThread implements Runnable {
private ArrayList<Queue<Customer>> customerWaitingLists;
private BlockingQueue<Customer> customerList;
private int numOfCheckout;
public AssigningThread(ArrayList<Queue<Customer>> customerWaitingLists, BlockingQueue<Customer> customerList, int numOfCheckout) {
this.customerWaitingLists = customerWaitingLists;
this.customerList = customerList;
this.numOfCheckout = numOfCheckout;
}
@Override
public void run() {
while (true) {
try {
Customer customerToken = customerList.take();
synchronized (customerWaitingLists) {
for (int i = 0; i < numOfCheckout; i++) {
Queue<Customer> q = customerWaitingLists.get(i);
if (q.size() < 6) {
q.offer(customerToken);
}
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
Several Checkout Threads:
public class CheckoutThread implements Runnable {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
public CheckoutThread(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
}
@Override
public void run() {
while (true) {
Customer customerPolled;
synchronized (customerWaitingLists) {
customerPolled = (Customer) customerWaitingLists.get(numOfCheckout).poll();
customerPolled.setCheckStartTime(new Date(System.currentTimeMillis()));
Integer timeOfCheckout = customerPolled.getTimeOfCheckout();
try {
Thread.sleep(timeOfCheckout);
} catch (InterruptedException e) {
e.printStackTrace();
}
customerPolled.setCheckEndTime(new Date(System.currentTimeMillis()));
}
synchronized(customerCheckedList){
customerCheckedList.add(customerPolled);
}
}
}
}
The Customer class:
public class Customer {
private Date arrivedTime;
private Integer timeOfCheckout;
private Date checkStartTime;
private Date checkEndTime;
public Date getArrivedTime() {
return arrivedTime;
}
public void setArrivedTime(Date arrivedTime) {
this.arrivedTime = arrivedTime;
}
public Integer getTimeOfCheckout() {
return timeOfCheckout;
}
public void setTimeOfCheckout(Integer timeOfCheckout) {
this.timeOfCheckout = timeOfCheckout;
}
public Date getCheckStartTime() {
return checkStartTime;
}
public void setCheckStartTime(Date checkStartTime) {
this.checkStartTime = checkStartTime;
}
public Date getCheckEndTime() {
return checkEndTime;
}
public void setCheckEndTime(Date checkEndTime) {
this.checkEndTime = checkEndTime;
}
}
The main thread:
public class MainApp {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
private BlockingQueue<Customer> customerList;
public MainApp(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList, BlockingQueue<Customer> customerList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
this.customerList = customerList;
test();
}
public void test() {
CustomerGeneratorThread cgt = new CustomerGeneratorThread(customerList);
new Thread(cgt).start();
AssigningThread at = new AssigningThread(customerWaitingLists, customerList, numOfCheckout);
new Thread(at).start();
for (int i = 0; i < numOfCheckout; i++) {
CheckoutThread ct = new CheckoutThread(numOfCheckout, customerWaitingLists, customerCheckedList);
new Thread(ct).start();
}
//sleep for 20s ,then, get wait time of each customer
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
synchronized (customerCheckedList) {
for (int i = 0; i < customerCheckedList.size(); i++) {
Customer c = customerCheckedList.get(i);
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
System.out.println((waitTime / 1000) + " sec");
}
}
}
public static void main(String args) {
MainApp mainApp = new MainApp(5, new ArrayList<Queue<Customer>>(), new ArrayList<Customer>(), new ArrayBlockingQueue());
}
}
Here is the problem:
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
The waitTime sometimes was assigned to a negative number which confused me.
A customer follows the sequence like this:
CustomerGeneratorThread(setArrivedTime) -> AssigningThread -> CheckoutThread(setCheckStartTime).
At this situation, the waitTime shouldn't be a negative number.
So, how to fix this problem?
Thanks in advance.
java multithreading date time
4
I downvoted because without code, it is very hard to help you
– Andreas
Nov 11 at 1:23
1
Check this answer stackoverflow.com/a/30120693/1654233. Perhaps your issue is of the same nature.
– yegodm
Nov 11 at 3:45
1
FYI, the terribly troublesome old date-time classes such asjava.util.Date
,java.util.Calendar
, andjava.text.SimpleDateFormat
are now legacy, supplanted by the java.time classes built into Java 8 and later. See Tutorial by Oracle.
– Basil Bourque
Nov 11 at 4:00
2
MCVE
– Basil Bourque
Nov 11 at 4:05
There are so many ways a bug in your program could cause this, so we need to see that in order to determine whether that could be cause or the problem lies somewhere else. It will probably be a non-trivial task to produce a Minimal, Complete, and Verifiable example, but I still think it’s your best way forward with this question.
– Ole V.V.
Nov 11 at 6:55
|
show 4 more comments
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
A Customer Generator Thread:
public class CustomerGeneratorThread implements Runnable {
private BlockingQueue<Customer> customerList;
public CustomerGeneratorThread(BlockingQueue<Customer> customerList){
this.customerList = customerList;
}
@Override
public void run() {
while(true){
//generate a new customer
Customer customer = new Customer();
customer.setArrivedTime(new Date(Sysmtem.currentTimeMillis()));
customer.setTimeOfCheckout(Math.random()*1000)
customerList.offer(customer);
}
}
}
An assigning Generator Thread:
public class AssigningThread implements Runnable {
private ArrayList<Queue<Customer>> customerWaitingLists;
private BlockingQueue<Customer> customerList;
private int numOfCheckout;
public AssigningThread(ArrayList<Queue<Customer>> customerWaitingLists, BlockingQueue<Customer> customerList, int numOfCheckout) {
this.customerWaitingLists = customerWaitingLists;
this.customerList = customerList;
this.numOfCheckout = numOfCheckout;
}
@Override
public void run() {
while (true) {
try {
Customer customerToken = customerList.take();
synchronized (customerWaitingLists) {
for (int i = 0; i < numOfCheckout; i++) {
Queue<Customer> q = customerWaitingLists.get(i);
if (q.size() < 6) {
q.offer(customerToken);
}
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
Several Checkout Threads:
public class CheckoutThread implements Runnable {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
public CheckoutThread(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
}
@Override
public void run() {
while (true) {
Customer customerPolled;
synchronized (customerWaitingLists) {
customerPolled = (Customer) customerWaitingLists.get(numOfCheckout).poll();
customerPolled.setCheckStartTime(new Date(System.currentTimeMillis()));
Integer timeOfCheckout = customerPolled.getTimeOfCheckout();
try {
Thread.sleep(timeOfCheckout);
} catch (InterruptedException e) {
e.printStackTrace();
}
customerPolled.setCheckEndTime(new Date(System.currentTimeMillis()));
}
synchronized(customerCheckedList){
customerCheckedList.add(customerPolled);
}
}
}
}
The Customer class:
public class Customer {
private Date arrivedTime;
private Integer timeOfCheckout;
private Date checkStartTime;
private Date checkEndTime;
public Date getArrivedTime() {
return arrivedTime;
}
public void setArrivedTime(Date arrivedTime) {
this.arrivedTime = arrivedTime;
}
public Integer getTimeOfCheckout() {
return timeOfCheckout;
}
public void setTimeOfCheckout(Integer timeOfCheckout) {
this.timeOfCheckout = timeOfCheckout;
}
public Date getCheckStartTime() {
return checkStartTime;
}
public void setCheckStartTime(Date checkStartTime) {
this.checkStartTime = checkStartTime;
}
public Date getCheckEndTime() {
return checkEndTime;
}
public void setCheckEndTime(Date checkEndTime) {
this.checkEndTime = checkEndTime;
}
}
The main thread:
public class MainApp {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
private BlockingQueue<Customer> customerList;
public MainApp(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList, BlockingQueue<Customer> customerList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
this.customerList = customerList;
test();
}
public void test() {
CustomerGeneratorThread cgt = new CustomerGeneratorThread(customerList);
new Thread(cgt).start();
AssigningThread at = new AssigningThread(customerWaitingLists, customerList, numOfCheckout);
new Thread(at).start();
for (int i = 0; i < numOfCheckout; i++) {
CheckoutThread ct = new CheckoutThread(numOfCheckout, customerWaitingLists, customerCheckedList);
new Thread(ct).start();
}
//sleep for 20s ,then, get wait time of each customer
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
synchronized (customerCheckedList) {
for (int i = 0; i < customerCheckedList.size(); i++) {
Customer c = customerCheckedList.get(i);
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
System.out.println((waitTime / 1000) + " sec");
}
}
}
public static void main(String args) {
MainApp mainApp = new MainApp(5, new ArrayList<Queue<Customer>>(), new ArrayList<Customer>(), new ArrayBlockingQueue());
}
}
Here is the problem:
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
The waitTime sometimes was assigned to a negative number which confused me.
A customer follows the sequence like this:
CustomerGeneratorThread(setArrivedTime) -> AssigningThread -> CheckoutThread(setCheckStartTime).
At this situation, the waitTime shouldn't be a negative number.
So, how to fix this problem?
Thanks in advance.
java multithreading date time
A Customer Generator Thread:
public class CustomerGeneratorThread implements Runnable {
private BlockingQueue<Customer> customerList;
public CustomerGeneratorThread(BlockingQueue<Customer> customerList){
this.customerList = customerList;
}
@Override
public void run() {
while(true){
//generate a new customer
Customer customer = new Customer();
customer.setArrivedTime(new Date(Sysmtem.currentTimeMillis()));
customer.setTimeOfCheckout(Math.random()*1000)
customerList.offer(customer);
}
}
}
An assigning Generator Thread:
public class AssigningThread implements Runnable {
private ArrayList<Queue<Customer>> customerWaitingLists;
private BlockingQueue<Customer> customerList;
private int numOfCheckout;
public AssigningThread(ArrayList<Queue<Customer>> customerWaitingLists, BlockingQueue<Customer> customerList, int numOfCheckout) {
this.customerWaitingLists = customerWaitingLists;
this.customerList = customerList;
this.numOfCheckout = numOfCheckout;
}
@Override
public void run() {
while (true) {
try {
Customer customerToken = customerList.take();
synchronized (customerWaitingLists) {
for (int i = 0; i < numOfCheckout; i++) {
Queue<Customer> q = customerWaitingLists.get(i);
if (q.size() < 6) {
q.offer(customerToken);
}
}
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
Several Checkout Threads:
public class CheckoutThread implements Runnable {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
public CheckoutThread(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
}
@Override
public void run() {
while (true) {
Customer customerPolled;
synchronized (customerWaitingLists) {
customerPolled = (Customer) customerWaitingLists.get(numOfCheckout).poll();
customerPolled.setCheckStartTime(new Date(System.currentTimeMillis()));
Integer timeOfCheckout = customerPolled.getTimeOfCheckout();
try {
Thread.sleep(timeOfCheckout);
} catch (InterruptedException e) {
e.printStackTrace();
}
customerPolled.setCheckEndTime(new Date(System.currentTimeMillis()));
}
synchronized(customerCheckedList){
customerCheckedList.add(customerPolled);
}
}
}
}
The Customer class:
public class Customer {
private Date arrivedTime;
private Integer timeOfCheckout;
private Date checkStartTime;
private Date checkEndTime;
public Date getArrivedTime() {
return arrivedTime;
}
public void setArrivedTime(Date arrivedTime) {
this.arrivedTime = arrivedTime;
}
public Integer getTimeOfCheckout() {
return timeOfCheckout;
}
public void setTimeOfCheckout(Integer timeOfCheckout) {
this.timeOfCheckout = timeOfCheckout;
}
public Date getCheckStartTime() {
return checkStartTime;
}
public void setCheckStartTime(Date checkStartTime) {
this.checkStartTime = checkStartTime;
}
public Date getCheckEndTime() {
return checkEndTime;
}
public void setCheckEndTime(Date checkEndTime) {
this.checkEndTime = checkEndTime;
}
}
The main thread:
public class MainApp {
private int numOfCheckout;
private ArrayList<Queue<Customer>> customerWaitingLists;
private ArrayList<Customer> customerCheckedList;
private BlockingQueue<Customer> customerList;
public MainApp(int numOfCheckout, ArrayList<Queue<Customer>> customerWaitingLists, ArrayList<Customer> customerCheckedList, BlockingQueue<Customer> customerList) {
this.numOfCheckout = numOfCheckout;
this.customerWaitingLists = customerWaitingLists;
this.customerCheckedList = customerCheckedList;
this.customerList = customerList;
test();
}
public void test() {
CustomerGeneratorThread cgt = new CustomerGeneratorThread(customerList);
new Thread(cgt).start();
AssigningThread at = new AssigningThread(customerWaitingLists, customerList, numOfCheckout);
new Thread(at).start();
for (int i = 0; i < numOfCheckout; i++) {
CheckoutThread ct = new CheckoutThread(numOfCheckout, customerWaitingLists, customerCheckedList);
new Thread(ct).start();
}
//sleep for 20s ,then, get wait time of each customer
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
synchronized (customerCheckedList) {
for (int i = 0; i < customerCheckedList.size(); i++) {
Customer c = customerCheckedList.get(i);
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
System.out.println((waitTime / 1000) + " sec");
}
}
}
public static void main(String args) {
MainApp mainApp = new MainApp(5, new ArrayList<Queue<Customer>>(), new ArrayList<Customer>(), new ArrayBlockingQueue());
}
}
Here is the problem:
long waitTime = c.getCheckStartTime().getTime() - c.getArrivedTime().getTime();
The waitTime sometimes was assigned to a negative number which confused me.
A customer follows the sequence like this:
CustomerGeneratorThread(setArrivedTime) -> AssigningThread -> CheckoutThread(setCheckStartTime).
At this situation, the waitTime shouldn't be a negative number.
So, how to fix this problem?
Thanks in advance.
java multithreading date time
java multithreading date time
edited Nov 12 at 13:42
asked Nov 11 at 1:12
Arthur Chen
32
32
4
I downvoted because without code, it is very hard to help you
– Andreas
Nov 11 at 1:23
1
Check this answer stackoverflow.com/a/30120693/1654233. Perhaps your issue is of the same nature.
– yegodm
Nov 11 at 3:45
1
FYI, the terribly troublesome old date-time classes such asjava.util.Date
,java.util.Calendar
, andjava.text.SimpleDateFormat
are now legacy, supplanted by the java.time classes built into Java 8 and later. See Tutorial by Oracle.
– Basil Bourque
Nov 11 at 4:00
2
MCVE
– Basil Bourque
Nov 11 at 4:05
There are so many ways a bug in your program could cause this, so we need to see that in order to determine whether that could be cause or the problem lies somewhere else. It will probably be a non-trivial task to produce a Minimal, Complete, and Verifiable example, but I still think it’s your best way forward with this question.
– Ole V.V.
Nov 11 at 6:55
|
show 4 more comments
4
I downvoted because without code, it is very hard to help you
– Andreas
Nov 11 at 1:23
1
Check this answer stackoverflow.com/a/30120693/1654233. Perhaps your issue is of the same nature.
– yegodm
Nov 11 at 3:45
1
FYI, the terribly troublesome old date-time classes such asjava.util.Date
,java.util.Calendar
, andjava.text.SimpleDateFormat
are now legacy, supplanted by the java.time classes built into Java 8 and later. See Tutorial by Oracle.
– Basil Bourque
Nov 11 at 4:00
2
MCVE
– Basil Bourque
Nov 11 at 4:05
There are so many ways a bug in your program could cause this, so we need to see that in order to determine whether that could be cause or the problem lies somewhere else. It will probably be a non-trivial task to produce a Minimal, Complete, and Verifiable example, but I still think it’s your best way forward with this question.
– Ole V.V.
Nov 11 at 6:55
4
4
I downvoted because without code, it is very hard to help you
– Andreas
Nov 11 at 1:23
I downvoted because without code, it is very hard to help you
– Andreas
Nov 11 at 1:23
1
1
Check this answer stackoverflow.com/a/30120693/1654233. Perhaps your issue is of the same nature.
– yegodm
Nov 11 at 3:45
Check this answer stackoverflow.com/a/30120693/1654233. Perhaps your issue is of the same nature.
– yegodm
Nov 11 at 3:45
1
1
FYI, the terribly troublesome old date-time classes such as
java.util.Date
, java.util.Calendar
, and java.text.SimpleDateFormat
are now legacy, supplanted by the java.time classes built into Java 8 and later. See Tutorial by Oracle.– Basil Bourque
Nov 11 at 4:00
FYI, the terribly troublesome old date-time classes such as
java.util.Date
, java.util.Calendar
, and java.text.SimpleDateFormat
are now legacy, supplanted by the java.time classes built into Java 8 and later. See Tutorial by Oracle.– Basil Bourque
Nov 11 at 4:00
2
2
MCVE
– Basil Bourque
Nov 11 at 4:05
MCVE
– Basil Bourque
Nov 11 at 4:05
There are so many ways a bug in your program could cause this, so we need to see that in order to determine whether that could be cause or the problem lies somewhere else. It will probably be a non-trivial task to produce a Minimal, Complete, and Verifiable example, but I still think it’s your best way forward with this question.
– Ole V.V.
Nov 11 at 6:55
There are so many ways a bug in your program could cause this, so we need to see that in order to determine whether that could be cause or the problem lies somewhere else. It will probably be a non-trivial task to produce a Minimal, Complete, and Verifiable example, but I still think it’s your best way forward with this question.
– Ole V.V.
Nov 11 at 6:55
|
show 4 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244975%2fhow-to-unify-the-datetimeline-in-different-threads%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
I downvoted because without code, it is very hard to help you
– Andreas
Nov 11 at 1:23
1
Check this answer stackoverflow.com/a/30120693/1654233. Perhaps your issue is of the same nature.
– yegodm
Nov 11 at 3:45
1
FYI, the terribly troublesome old date-time classes such as
java.util.Date
,java.util.Calendar
, andjava.text.SimpleDateFormat
are now legacy, supplanted by the java.time classes built into Java 8 and later. See Tutorial by Oracle.– Basil Bourque
Nov 11 at 4:00
2
MCVE
– Basil Bourque
Nov 11 at 4:05
There are so many ways a bug in your program could cause this, so we need to see that in order to determine whether that could be cause or the problem lies somewhere else. It will probably be a non-trivial task to produce a Minimal, Complete, and Verifiable example, but I still think it’s your best way forward with this question.
– Ole V.V.
Nov 11 at 6:55