[JBoss-user] [Performance Tuning] - Re: SessionBean vs. Static Method

2006-06-03 Thread Lauri
I'd prefer staless bean which operates with local enity beans. It should be 
slower than usual static method but it will bring all the advances from message 
above.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948884#3948884

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948884


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Performance Tuning] - Re: SessionBean vs. Static Method

2006-06-03 Thread Lauri
Static methods live inside one virtual machine and it is you who must take 
resposibility to "scale" solution and take other decisions on mny other issues.

On other hand, J2EE containers does much the dirty work for you. You just need 
to give some details in deplayment descriptors.
Container will decide how many instances of the loader/saved it needs to serve 
all incoming requests with optimal latency. Also J2EE edition of the 
loader/saver might be scaleable between many machines if J2ee container 
supports scaling.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948882#3948882

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948882


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Single UPDATE instead of SELECT, then UPDATE

2006-06-02 Thread Lauri
The problem has been solved.
I'd like to share the story.

The question was going from obivious lack of J2EE and JBoss experience and 
understanding.
I was absolutely sure that dataSource.getConnection() returns free connection 
and this free connection means new transaction.

I've had tried to use same datasource for cmp beans and session beans. Lets say 
it is registered as java:jdbc/cmp in global evinonent (possibly other 
depoyments use java:DefaultDS or java:MySqlDS).
I've placed a ref link to it for my Session bean Cashier. In xdoclet attributes 
it looks like:

  | @ejb.resource-ref res-ref-name="dataSource" ref-type="javax.sql.DataSource" 
jndi-name="java:jdbc/cmp" res-auth="Container"
  | @jboss.resource-ref res-ref-name="dataSource" jndi-name="java:jdbc/cmp" 
  | 
Cashier session bean has a private field of javax.sql.DataSource type 
dataSource. It is being initialized in ejbCreate()

  | public void ejbCreate() throws CreateException {
  |try {
  |   InitialContext ctx = new InitialContext();
  |   this.dataSource = (DataSource) ctx.lookup("java:comp/env/dataSource");
  |   //
  |} catch (NamingException nEx) {
  |   throw new RuntimeException(nEx);
  |}
  | }
  | 
Now dataSource field is usable.
So deposit() method from example above has changed to

  | public void deposit(Integer customerId, int value) throws RemoteException {
  | Connection conn = null;
  | try {
  |conn = this.dataSource.getConnection();
  |PreparedStatement stmt = conn.prepareStatement("UPDATE customer SET 
credits=credits+? WHERE id =?");
  |stmt.setInt(1, value);
  |stmt.setObject(2, customerId);
  |stmt.executeUpdate();
  | } catch  {
  | /// bla bla. catch some  common exceptions
  | } finally {
  |if(conn != null) {
  |try {
  |   conn.close();
  |} catch (SQLException sqlEx) {
  |   // log error
  |}
  |} 
  | }
  | }
  | 
That is really simple and was hard for me to believe.
Queries generated inside new deposit method come inside transaction which is 
managed by container! (I've verified it from mysql query logs). It is forbidden 
to use conn.commit(), conn.rollback() and conn.setAutoComint(...) methods, an 
exception will be thrown and whole transaction will be rolled back.

Similar solution has been applied to many methods for local edition of the 
Cashier bean.

Total application has been stress tested with REPETABLE_READ isolation level 
for mysql. Works perfectly.

At least one drawback indeed exist, now sql code moved to java code (or 
deployment descriptors). It is not very beautiful to my humble opinion. 

P.S. Next question of curiosity. Will other containers behave in the same way? 
I hope it will never come to find an answer myself :).

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948785#3948785

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948785


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Automatic generation of primary key

2006-06-02 Thread Lauri
I don't know what it could be then :(.

As far as i understand, general idea of pk generation is to tell EJB engine 
what type (class) of pk it will be, and tell details to jboss personally.

Something about integer type should be mentioned in ejb-jar.xml and particular 
instructions in jbosscmp-jdbc.xml 

How your ejbCreate and ejbPostCreate looks like?

It should not contain pk field in signature and no calls to pk inside i mean 
nothing of
getId() (could be not assigned yet)
and 
setId(id) will override autoincremented value.

That is just my current understanding, it works for me.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948702#3948702

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948702


___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB/JBoss] - Re: Single UPDATE instead of SELECT, then UPDATE

2006-06-01 Thread Lauri
Oh, same on me... wrong forum.
Somebody please remove topic from here. I've already reposted it to 
"Persistance" forum 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948303#3948303

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948304#3948304

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948304


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence,JBoss/CMP, Hibernate, Database] - Single UPDATE instead of SELECT, then UPDATE

2006-06-01 Thread Lauri
Good afternoon.

Common entty bean contain a number of set and get methods. Here we have a 
Customer bean with field named credits.
Also we have a Session bean named Cashier with deposit method. In general this 
method looks like:

  | 
  | public void deposit(Integer customerId, int value) throws RemoteException {
  | try {
  |  CustomerLocal customer = 
this.customerHome.findByPrimaryKey(customerId);
  |   int credits = customer.getCredits()+value;
  |   if(credits < 0) {
  |throw new OutOfCreditsBuisenessException("");
  |   }
  |   customer.setCredits(credits);
  | } catch  {
  | /// bla bla. catch some  common exceptions
  | }
  | }
  | 


Invocation of this method results in two queries
1) SELECT credits FROM customer WHERE id=?
2) UPDATE customer SET credits=? WHERE id=?

That is good enoght for those who are using SERIALIZABLE tx isolation level. We 
can not afford it with mysql here, the level leads to locks on customer table 
(i.e. customer spends credits and deposits it a same time) and we have to use 
REPETABLE_READ instead.

Is that possible somehow to merge two queries to one like:
UPDATE customer SET credits=credits+? WHERE id=?
I know that it is possible by using direct connection with db. But this will 
mean new transaction per each deposit. Is that avoidable?

Could it be that SERIALIZABLE tx isolation level is a weak point of mysql and 
we should consider migration to another db?

Thanks for attention.

P.s. Don't know if this forum best place for such a question. Hits where 
shold-I-place-the-question are welcome too :).

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948303#3948303

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948303


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [EJB/JBoss] - Single UPDATE instead of SELECT, then UPDATE

2006-06-01 Thread Lauri
Good afternoon.

Common entty bean contain a number of set and get methods. Here we have a 
Customer bean with field named credits.
Also we have a Session bean named Cashier with deposit method. In general this 
method looks like:

  | public void deposit(Integer customerId, int value) throws RemoteException {
  | try {
  |  CustomerLocal customer = 
this.customerHome.findByPrimaryKey(customerId);
  |   int credits = customer.getCredits()+value;
  |   if(credits < 0) {
  |throw new OutOfCreditsBuisenessException("");
  |   }
  |   customer.setCredits(credits);
  | } catch  {
  | /// bla bla. catch some  common exceptions
  | }
  | }
  | 
Invocation of this method results in two queries
1) SELECT credits FROM customer WHERE id=?
2) UPDATE customer SET credits=? WHERE id=?

That is good enoght for those who are using SERIALIZABLE tx isolation level. We 
can not afford it with mysql here, the level leads to locks on customer table 
(i.e. customer spends credits and deposits it a same time) and we have to use 
REPETABLE_READ instead.

Is that possible somehow to merge two queries to one like:
UPDATE customer SET credits=credits+? WHERE id=?
I know that it is possible by using direct connection with db. But this will 
mean new transaction per each deposit. Is that avoidable?

Could it be that SERIALIZABLE tx isolation level is a weak point of mysql and 
we should consider migration to another db?

Thanks for attention.

P.s. Don't know if this forum best place for such a question. Hits where 
shold-I-place-the-question are welcome too :).

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3948290#3948290

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3948290


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS & JBossMQ] - Re: Memory leak and tons of org.jboss.mq.SpyTopic and org.jb

2006-02-28 Thread Lauri
For those who will find this topic as answer to mysql "connection reset" search 
query.
The problem has been solved too.

Connection have had been really closed by mysql.
It was and is set up with WAIT_TIMEOUT less than 1 minute (I guess that admin 
had tried to minimize connection leaks for php ?)

I have changed connection string in -ds.xml file to 
jdbc:mysql://spinity.com:3306/java?autoReconnectForPools=true&sessionVariables=wait_timeout=28800
(don't forget to mark the string as CDATA)
note sessionVariables=wait_timeout=28800
I'm not sure that autoReconnectForPools is a good idea.
Useful links
http://dev.mysql.com/doc/refman/5.0/en/cj-configuration-properties.html
http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpAMysqlDatasource (here stated 
that autoReconnect is not a good idea, but nothing about autoReconnectForPools).


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3926780#3926780

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3926780


---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS & JBossMQ] - Re: Memory leak and tons of org.jboss.mq.SpyTopic and org.jb

2006-02-18 Thread Lauri
"hosierdm" wrote : Why are you explicitly acknowledging your messages in the 
client when you clearly have the session set to auto acknowledge?
That is undoubtly kind of mistake (or more likely mess) in code. Now it fixed.
- - -
About JIRA.
Adrian, should i place it there or better not?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3924771#3924771

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3924771


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS & JBossMQ] - Re: Memory leak and tons of org.jboss.mq.SpyTopic and org.jb

2006-02-17 Thread Lauri
One leak source has been found.
Producer sessions were started as (note false)
session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
Consumer sessions started as (note true)
session = conn.createTopicSession(true, TopicSession.AUTO_ACKNOWLEDGE);
and onMessage(message) contains
message.acknowledge();
I think that since producer was not transactional and was with AUTO_ACKNOWLEDGE 
flag, each time when clint call to message.acknowledge(); instance of 
org.jboss.mq.AcknowledgementRequest was created.
---
I've replased true to false in client side and have removed 
message.acknowledge(). It helped much!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3924556#3924556

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3924556


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS & JBossMQ] - Re: JBoss 3.2.5 Deployment Errors

2006-02-15 Thread Lauri
I would say that your some of your .xml files are broken.
Try to check'em using some xml reader. IE will be enought.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923968#3923968

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923968


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS & JBossMQ] - Additional information.

2006-02-15 Thread Lauri
configuration
  Jboss 4.0.3
  JDK 1.5.0_06
  SunOS 5.9 Generic_118559-09 i86pc i386 i86pc
  mysql 4.1

I've noticed that SELECT count(*)  FROM JMS_MESSAGES returns amount of 
org.jboss.mq.AcknowledgementRequest and org.jboss.mq.SpyTopic objects in 
jmap -histo output.

What could it mean?


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923887#3923887

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923887


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS & JBossMQ] - Re: Memory leak and tons of org.jboss.mq.SpyTopic and org.jb

2006-02-15 Thread Lauri
Forgot to place question.
Does anybody have ideas how to 
1) eliminate memory leaks
2) connection resets from mysql
?
Thanks for advance.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923806#3923806

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923806


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Messaging, JMS & JBossMQ] - Memory leak and tons of org.jboss.mq.SpyTopic and org.jboss.

2006-02-15 Thread Lauri
Hello people.

I'm new to JBoss (~month of experience), however i've migrated production 
installation of project to JBoss from SunApplication server.
It runs much better, but we're now facing memory leak.
We're running jboss as application server and some socket daemons as clients 
for the server.
Now both (client and server) consumes memory. I've compared "jmap -histo pid" 
results for client after 12 hours of heavy load.
It is obivious that amount 
org.jboss.mq.SpyTopic and 
org.jboss.mq.AcknowledgementRequest has grown
Was (1column is bytes, 2nd - amount of instances, 3d - class name):
anonymous wrote : 182016  7584org.jboss.mq.SpyTopic
  | 181992  7583org.jboss.mq.AcknowledgementReque
  | 
After 12 hours
anonymous wrote : 
  | 917760  38240   org.jboss.mq.SpyTopic
  | 917736  38239   org.jboss.mq.AcknowledgementRequest
  | 
The client-server uses JMS communication a lot.
Client message handler:

  | public void onMessage(javax.jms.Message message) {
  | try {
  | message.acknowledge();
  | MapMessage mapMessage = (MapMessage) message;
  |//...actions on message
  | } catch (JMSException jmsEx) {
  | logger.log(Level.INFO, "Error processing message", jmsEx);
  | } catch (ClassCastException cCEx) {
  | logger.fine(cCEx.getMessage());
  | }
  | 
  | }
  | 
Server side (in session and eninty beans) message producer

  | private void notifyClientListeners(Integer playerId, String serverId) {
  | try {
  | TopicSession session = null;
  | Topic topic = this.serverTopic; // acquired in 
ejbCreate from JNDI env.
  | TopicConnectionFactory tcf = this.jmsFactory; // 
acquired in ejbCreate from JNDI env.
  | TopicConnection conn = 
tcf.createTopicConnection(this.jmsUserName, this.jmsUserPassword);
  | 
  | session = conn.createTopicSession(false, 
TopicSession.AUTO_ACKNOWLEDGE);
  | conn.start();
  | 
  | TopicPublisher send = session.createPublisher(topic);
  | 
  | MapMessage mapMessage = session.createMapMessage();
  | mapMessage.setString(JMSConstants.JMS_MESSAGE_NAME, 
JMSConstants.JMS_PLAYER_CONNECT);
  | mapMessage.setInt(JMSConstants.JMS_PLAYER_ID, 
playerId.intValue());
  | mapMessage.setString(JMSConstants.JMS_SERVER_ID, serverId);
  | 
  | send.publish(mapMessage);
  | 
  | send.close();
  | session.close();
  | conn.close();
  | } catch (Exception ex) {
  | logger.log(Level.WARNING, "Unable to notify servers", ex);
  | }
  | }
  | 

JMS connectivity works using mysql. Here we have a error too. Sometimes 
following error occures:
anonymous wrote : 06:25:45,394 WARN  [LocalManagedConnectionFactory] Destroying 
connection that is not valid, due to the following exception: [EMAIL PROTECTED]
  | com.mysql.jdbc.CommunicationsException: Communications link failure due to 
underlying exception:
  | 
  | ** BEGIN NESTED EXCEPTION **
  | 
  | java.net.SocketException
  | MESSAGE: Connection reset
  | 
  | STACKTRACE:
  | 
  | java.net.SocketException: Connection reset
  | at java.net.SocketInputStream.read(SocketInputStream.java:113)
  | at 
com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
  | 
This error occures in many cases, JMS, entiny beans and so on. But we don't 
have data loss.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923805#3923805

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923805


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence,JBoss/CMP, Hibernate, Database] - Re: WARN [TxConnectionManager] Connection error occured

2006-02-14 Thread Lauri
Good afternood.
I've faced this problem too.
Actually i don't know what is it, but it doesn't affect my project since i've 
added this line to datasource setup file.
SELECT 1
My configuration is Solaris/JBoss 4.0.3/mysql 4.1

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3923605#3923605

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3923605


---
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
___
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user