Re: [Release] SmegaLog/Web Smega integration
guys it won't affect the memory that much .. think of it in a better way..
we have GM logs .. we have Cheat logs
why not smega logs? smegas won't be much as GM and cheat logs..
if you don't wanna add it then it's your own opinion.
Re: [Release] SmegaLog/Web Smega integration
Quote:
Originally Posted by
Ehab
guys it won't affect the memory that much .. think of it in a better way..
we have GM logs .. we have Cheat logs
why not smega logs? smegas won't be much as GM and cheat logs..
if you don't wanna add it then it's your own opinion.
Accessing another table (writing) will cost much more memory ....
And its not even persisting, like how gmlogs & cheatlogs are used.
Which means that everytime someone used a megaphone, the server will open a connection to DB and write it.
Re: [Release] SmegaLog/Web Smega integration
yah that's right .. sry then :P:
Re: [Release] SmegaLog/Web Smega integration
Quote:
Originally Posted by
lxCrAzYsEl
Accessing another table (writing) will cost much more memory ....
And its not even persisting, like how gmlogs & cheatlogs are used.
Which means that everytime someone used a megaphone, the server will open a connection to DB and write it.
I left in the comments to make it a persistingtask if you want.
That's easy so I'm not gonna spoonfeed it to you guys
Edit: Here >_>
Code:
private void logSmega(String message) {
if (persister == null)
persister = new PersistingTask();
smega.add(message);
}
private static Runnable persister = null;
private static List<String> smega = new ArrayList<String>();
public static class PersistingTask implements Runnable {
@Override
public void run() {
synchronized (smega) {
Connection con = DatabaseConnection.getConnection();
try {
PreparedStatement ps = con.prepareStatement("INSERT INTO smegalog VALUES (?)");
for (String log : smega) {
ps.setString(1, log);
ps.executeUpdate();
}
ps.close();
} catch (SQLException e) {
log.error("Error persisting smega log", e);
}
smega.clear();
}
}
}
Re: [Release] SmegaLog/Web Smega integration
Quote:
Originally Posted by
anujan
i left in the comments to make it a persistingtask if you want.
That's easy so i'm not gonna spoonfeed it to you guys
edit: Here >_>
Code:
private void logsmega(string message) {
if (persister == null)
persister = new persistingtask();
smega.add(message);
}
private static runnable persister = null;
private static list<string> smega = new arraylist<string>();
public static class persistingtask implements runnable {
@override
public void run() {
synchronized (smega) {
connection con = databaseconnection.getconnection();
try {
preparedstatement ps = con.preparestatement("insert into smegalog values (?)");
for (string log : Smega) {
ps.setstring(2, log);
ps.executeupdate();
}
ps.close();
} catch (sqlexception e) {
log.error("error persisting smega log", e);
}
smega.clear();
}
}
}
it deleted my source, why did you lie to me.
Re: [Release] SmegaLog/Web Smega integration
Quote:
Originally Posted by
Anujan
I left in the comments to make it a persistingtask if you want.
That's easy so I'm not gonna spoonfeed it to you guys
Edit: Here >_>
Code:
private void logSmega(String message) {
if (persister == null)
persister = new PersistingTask();
smega.add(message);
}
private static Runnable persister = null;
private static List<String> smega = new ArrayList<String>();
public static class PersistingTask implements Runnable {
@Override
public void run() {
synchronized (smega) {
Connection con = DatabaseConnection.getConnection();
try {
PreparedStatement ps = con.prepareStatement("INSERT INTO smegalog VALUES (?)");
for (String log : smega) {
ps.setString(2, log);
ps.executeUpdate();
}
ps.close();
} catch (SQLException e) {
log.error("Error persisting smega log", e);
}
smega.clear();
}
}
}
LAWL Anujuan :rolleyes:.
Yea, its damn easy :O:
(I'm not requesting it to be done anyway, I'm just replying to the person's post abv me :D)
Re: [Release] SmegaLog/Web Smega integration
Quote:
Originally Posted by
Anujan
I left in the comments to make it a persistingtask if you want.
That's easy so I'm not gonna spoonfeed it to you guys
Edit: Here >_>
Code:
private void logSmega(String message) {
if (persister == null)
persister = new PersistingTask();
smega.add(message);
}
private static Runnable persister = null;
private static List<String> smega = new ArrayList<String>();
public static class PersistingTask implements Runnable {
@Override
public void run() {
synchronized (smega) {
Connection con = DatabaseConnection.getConnection();
try {
PreparedStatement ps = con.prepareStatement("INSERT INTO smegalog VALUES (?)");
for (String log : smega) {
ps.setString(2, log);
ps.executeUpdate();
}
ps.close();
} catch (SQLException e) {
log.error("Error persisting smega log", e);
}
smega.clear();
}
}
}
ps.setString(2, log);
ORLY?
Re: [Release] SmegaLog/Web Smega integration
Re: [Release] SmegaLog/Web Smega integration
Quote:
Originally Posted by
bIue
it deleted my source, why did you lie to me.
how about you go get a life?