Revert "Revert "Make the migration tool better""
This reverts commit fcf86712f7
.
This commit is contained in:
parent
0c3470cd69
commit
5a91d9a363
@ -25,11 +25,19 @@ public class Main
|
|||||||
|
|
||||||
private File _info;
|
private File _info;
|
||||||
|
|
||||||
|
private boolean _complete = false;
|
||||||
|
|
||||||
|
private int _nextStart;
|
||||||
|
|
||||||
public Main()
|
public Main()
|
||||||
{
|
{
|
||||||
int start = 0;
|
int start = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (new File(new File(".").getCanonicalPath() + File.separator + "complete.dat").exists())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
_info = new File(new File(".").getCanonicalPath() + File.separator + "converterInfo.dat");
|
_info = new File(new File(".").getCanonicalPath() + File.separator + "converterInfo.dat");
|
||||||
System.out.println(_info.getCanonicalPath());
|
System.out.println(_info.getCanonicalPath());
|
||||||
if (_info.exists())
|
if (_info.exists())
|
||||||
@ -46,7 +54,12 @@ public class Main
|
|||||||
Files.write("0".getBytes(), _info);
|
Files.write("0".getBytes(), _info);
|
||||||
}
|
}
|
||||||
|
|
||||||
convertGroup(start);
|
_nextStart = start;
|
||||||
|
|
||||||
|
while (!_complete)
|
||||||
|
{
|
||||||
|
convertGroup(_nextStart);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
@ -123,46 +136,49 @@ public class Main
|
|||||||
s.execute("DELETE FROM accountStat WHERE accountId=" + accountId + ";");
|
s.execute("DELETE FROM accountStat WHERE accountId=" + accountId + ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
complete(start);
|
completeGroup(start);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.out.println("[INFO] Conversion complete");
|
System.out.println("[INFO] Conversion complete");
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
try
|
new File(new File(".").getCanonicalPath() + File.separator + "complete.dat").createNewFile();
|
||||||
{
|
|
||||||
Thread.sleep(3000);
|
|
||||||
}
|
|
||||||
catch (InterruptedException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
_complete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
_complete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void complete(int start)
|
private void completeGroup(int start)
|
||||||
{
|
{
|
||||||
int nextStart = start + 10000;
|
_nextStart = start + 10000;
|
||||||
if (_info.delete())
|
if (_info.delete())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_info.createNewFile();
|
_info.createNewFile();
|
||||||
Files.write((nextStart + "").getBytes(), _info);
|
Files.write((_nextStart + "").getBytes(), _info);
|
||||||
System.out.println("[INFO] Completed " + start + " to " + (nextStart - 1));
|
System.out.println("[INFO] Completed " + start + " to " + (_nextStart - 1));
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
_complete = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_complete = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user