From 613f3095daaab90563f1046df4cffe02ef91e7ea Mon Sep 17 00:00:00 2001 From: Sweidan Omar Date: Mon, 6 Dec 2021 11:13:57 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C32443 --- .../src/user/commons/SequenceGenerator.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/user.jobengine.osgi.db/src/user/commons/SequenceGenerator.java b/server/user.jobengine.osgi.db/src/user/commons/SequenceGenerator.java index 47f5e5ac..8a97c7f3 100644 --- a/server/user.jobengine.osgi.db/src/user/commons/SequenceGenerator.java +++ b/server/user.jobengine.osgi.db/src/user/commons/SequenceGenerator.java @@ -8,7 +8,7 @@ import java.io.FileOutputStream; public class SequenceGenerator { static private String persistFile = "c:\\id.generator"; static private long id = 0; - + static public long getId() { try { DataInputStream inStream = new DataInputStream(new FileInputStream(persistFile)); @@ -16,16 +16,17 @@ public class SequenceGenerator { inStream.close(); } catch (Exception e) { e.printStackTrace(); - } + } id++; - + try { DataOutputStream outStream = new DataOutputStream(new FileOutputStream(persistFile)); outStream.writeLong(id); + outStream.close(); } catch (Exception e) { e.printStackTrace(); - } - return id; + } + return id; } } -- 2.54.0