Lottery end time should not be scheduled in the past.
This commit is contained in:
@@ -189,8 +189,9 @@ public class Lottery
|
||||
_enddate = finishtime.getTimeInMillis();
|
||||
}
|
||||
|
||||
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
|
||||
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
|
||||
final long endDate = _enddate - System.currentTimeMillis();
|
||||
ThreadPool.schedule(new stopSellingTickets(), Math.max(endDate - (10 * MINUTE), 0));
|
||||
ThreadPool.schedule(new finishLottery(), Math.max(endDate, 0));
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
|
@@ -189,8 +189,9 @@ public class Lottery
|
||||
_enddate = finishtime.getTimeInMillis();
|
||||
}
|
||||
|
||||
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
|
||||
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
|
||||
final long endDate = _enddate - System.currentTimeMillis();
|
||||
ThreadPool.schedule(new stopSellingTickets(), Math.max(endDate - (10 * MINUTE), 0));
|
||||
ThreadPool.schedule(new finishLottery(), Math.max(endDate, 0));
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
|
@@ -67,11 +67,6 @@ public class Lottery
|
||||
}
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _number;
|
||||
@@ -185,8 +180,9 @@ public class Lottery
|
||||
_enddate = finishtime.getTimeInMillis();
|
||||
}
|
||||
|
||||
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
|
||||
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
|
||||
final long endDate = _enddate - System.currentTimeMillis();
|
||||
ThreadPool.schedule(new stopSellingTickets(), Math.max(endDate - (10 * MINUTE), 0));
|
||||
ThreadPool.schedule(new finishLottery(), Math.max(endDate, 0));
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_LOTTERY))
|
||||
@@ -513,6 +509,11 @@ public class Lottery
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final Lottery INSTANCE = new Lottery();
|
||||
|
@@ -67,11 +67,6 @@ public class Lottery
|
||||
}
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _number;
|
||||
@@ -185,8 +180,9 @@ public class Lottery
|
||||
_enddate = finishtime.getTimeInMillis();
|
||||
}
|
||||
|
||||
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
|
||||
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
|
||||
final long endDate = _enddate - System.currentTimeMillis();
|
||||
ThreadPool.schedule(new stopSellingTickets(), Math.max(endDate - (10 * MINUTE), 0));
|
||||
ThreadPool.schedule(new finishLottery(), Math.max(endDate, 0));
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_LOTTERY))
|
||||
@@ -513,6 +509,11 @@ public class Lottery
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final Lottery INSTANCE = new Lottery();
|
||||
|
@@ -67,11 +67,6 @@ public class Lottery
|
||||
}
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _number;
|
||||
@@ -185,8 +180,9 @@ public class Lottery
|
||||
_enddate = finishtime.getTimeInMillis();
|
||||
}
|
||||
|
||||
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
|
||||
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
|
||||
final long endDate = _enddate - System.currentTimeMillis();
|
||||
ThreadPool.schedule(new stopSellingTickets(), Math.max(endDate - (10 * MINUTE), 0));
|
||||
ThreadPool.schedule(new finishLottery(), Math.max(endDate, 0));
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_LOTTERY))
|
||||
@@ -513,6 +509,11 @@ public class Lottery
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final Lottery INSTANCE = new Lottery();
|
||||
|
@@ -67,11 +67,6 @@ public class Lottery
|
||||
}
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _number;
|
||||
@@ -185,8 +180,9 @@ public class Lottery
|
||||
_enddate = finishtime.getTimeInMillis();
|
||||
}
|
||||
|
||||
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
|
||||
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
|
||||
final long endDate = _enddate - System.currentTimeMillis();
|
||||
ThreadPool.schedule(new stopSellingTickets(), Math.max(endDate - (10 * MINUTE), 0));
|
||||
ThreadPool.schedule(new finishLottery(), Math.max(endDate, 0));
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_LOTTERY))
|
||||
@@ -513,6 +509,11 @@ public class Lottery
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Lottery getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final Lottery INSTANCE = new Lottery();
|
||||
|
Reference in New Issue
Block a user