Мда, точно - ждёт.
Увеличил нагрузку и посмотрел это в Log'ах.
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package SessionBeans;
import Entity.DebugTest;
import Entity.Schet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ejb.Stateless;
import javax.persistence.*;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
@Stateless(name = "EMDebugSessionBean", mappedName = "EMDebugSessionBean")
public class EMDebugSessionBean implements EMDebugSessionBeanRemote {
//@PersistenceContext(unitName = "EMDebugPU")
//private EntityManager em;
EntityManagerFactory emf;
EntityManager em;
private void init(){
emf = Persistence.createEntityManagerFactory("EMDebugPU");
//em=emf.createEntityManager();
Map properties = new HashMap();
properties.put("javax.persistence.jdbc.user", "medfin");
properties.put("javax.persistence.jdbc.password", "medfin");
//properties.put("javax.persistence.jdbc.url", "jdbc:oracle:thin:@pgserver1:1521:XE");
//properties.put("eclipselink.jdbc.exclusive-connection.mode", "Transactional");
//properties.put("eclipselink.jdbc.exclusive-connection.is-lazy", "true");
properties.put("eclipselink.jdbc.exclusive-connection.mode", "Always");
properties.put("eclipselink.jdbc.exclusive-connection.is-lazy", "false");
em = emf.createEntityManager(properties);
/*
Map properties = new HashMap();
properties.put("eclipselink.oracle.proxy-type", oracle.jdbc.OracleConnection.PROXYTYPE_USER_NAME);
properties.put(oracle.jdbc.OracleConnection.PROXY_USER_NAME, "medfin");
properties.put(oracle.jdbc.OracleConnection.PROXY_USER_PASSWORD, "medfin");
properties.put("eclipselink.jdbc.exclusive-connection.mode", "Always");
properties.put("eclipselink.jdbc.exclusive-connection.is-lazy", "false");
EntityManager em = emf.createEntityManager(properties);
*/
String gq="";
}
@Override
public String retHello() {
init();
/*
EntityTransaction et=em.getTransaction();
et.begin();
//em.joinTransaction();
DebugTest dt=new DebugTest();
dt.setId(Long.valueOf(Double.valueOf(Math.random()*1000000+10).longValue()));
dt.setData("Value "+Long.valueOf(Double.valueOf(Math.random()*100).longValue()).toString());
//em.persist(dt);
et.commit();
*/
for(int i=0;i<1000;i++){
EntityTransaction et2=em.getTransaction();
et2.begin();
DebugTest dt2=new DebugTest();
//dt2.setId(Long.valueOf(Double.valueOf(Math.random()*1000000+12).longValue()));
dt2.setId(Long.valueOf(i+1));
dt2.setData("Value "+Long.valueOf(Double.valueOf(Math.random()*100).longValue()).toString());
em.persist(dt2);
et2.commit();
}
/*
EntityTransaction et3=em.getTransaction();
et3.begin();
DebugTest dt3=new DebugTest();
dt3.setId(Long.valueOf(Double.valueOf(Math.random()*1000000).longValue()));
dt3.setData("Value "+Long.valueOf(Double.valueOf(Math.random()*100).longValue()).toString());
em.persist(dt3);
et3.commit();
*/
List<Object> some=get(DebugTest.class);
List<Object> some2=get(Schet.class);
destroy_em();
return "Hello from EMDebug Session Bean! "+some.size();
}
private List<Object> get(Class table){
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Object> criteriaQuery = criteriaBuilder.createQuery();
Root<Object> from = criteriaQuery.from(table);
CriteriaQuery<Object> select = criteriaQuery.select(from);
TypedQuery<Object> typedQuery = em.createQuery(select);
List<Object> some_ret = typedQuery.getResultList();
return some_ret;
}
private void destroy_em(){
em.close();
emf.close();
}
}
Это с пулом = 8.
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17.
INFO: [EL Fine]: 2012-06-06 15:55:09.387--ClientSession(19243773)--Connection(17885606)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [564, Value 71]
INFO: [EL Fine]: 2012-06-06 15:55:09.392--ClientSession(9671587)--Connection(8656258)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [274, Value 86]
INFO: [EL Fine]: 2012-06-06 15:55:09.394--ClientSession(19243773)--Connection(17885606)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [565, Value 24]
INFO: [EL Fine]: 2012-06-06 15:55:09.399--ClientSession(9671587)--Connection(8656258)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [275, Value 83]
INFO: [EL Fine]: 2012-06-06 15:55:09.401--ClientSession(19243773)--Connection(17885606)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [566, Value 67]
INFO: [EL Fine]: 2012-06-06 15:55:09.406--ClientSession(9671587)--Connection(8656258)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [276, Value 11]
А это с пулом = 1.
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52.
INFO: [EL Fine]: 2012-06-06 15:57:23.802--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [994, Value 12]
INFO: [EL Fine]: 2012-06-06 15:57:23.808--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [995, Value 97]
INFO: [EL Fine]: 2012-06-06 15:57:23.82--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [996, Value 55]
INFO: [EL Fine]: 2012-06-06 15:57:23.827--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [997, Value 26]
INFO: [EL Fine]: 2012-06-06 15:57:23.836--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [998, Value 64]
INFO: [EL Fine]: 2012-06-06 15:57:23.845--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [999, Value 16]
INFO: [EL Fine]: 2012-06-06 15:57:23.86--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [1000, Value 5]
INFO: [EL Fine]: 2012-06-06 15:57:23.905--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--SELECT ID, DATA FROM MEDFIN.DEBUG_TEST
INFO: [EL Fine]: 2012-06-06 15:57:24.075--ClientSession(25163859)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--SELECT ID_PAK, CODE_MO, COMENTS, CRC32, CREATED, DATA, DSCHET, FNAME, FROM_SUBJ, MONTH, NSCHET, TO_SUBJ, TYPEMESS, USER_ID, VERSION, YEAR FROM MEDFIN.SCHET
INFO: [EL Config]: 2012-06-06 15:57:24.083--ServerSession(4080117)--Connection(14438497)--Thread(Thread[p: thread-pool-1; w: 6,5,main])--disconnect
INFO: [EL Config]: 2012-06-06 15:57:24.087--ServerSession(4080117)--Connection(12902048)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--connecting(DatabaseLogin(
platform=>OraclePlatform
user name=> "medfin"
datasource URL=> "jdbc:oracle:thin:@pgserver1:1521:XE"
))
INFO: [EL Config]: 2012-06-06 15:57:24.156--ServerSession(4080117)--Connection(33361211)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--Connected: jdbc:oracle:thin:@pgserver1:1521:XE
User: MEDFIN
Database: Oracle Version: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Driver: Oracle JDBC driver Version: 11.2.0.3.0
INFO: [EL Fine]: 2012-06-06 15:57:24.157--ClientSession(3855040)--Connection(33361211)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [1, Value 0]
INFO: [EL Fine]: 2012-06-06 15:57:24.162--ClientSession(3855040)--Connection(33361211)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [2, Value 75]
INFO: [EL Fine]: 2012-06-06 15:57:24.167--ClientSession(3855040)--Connection(33361211)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [3, Value 82]
INFO: [EL Fine]: 2012-06-06 15:57:24.171--ClientSession(3855040)--Connection(33361211)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [4, Value 35]
INFO: [EL Fine]: 2012-06-06 15:57:24.176--ClientSession(3855040)--Connection(33361211)--Thread(Thread[p: thread-pool-1; w: 4,5,main])--INSERT INTO MEDFIN.DEBUG_TEST (ID, DATA) VALUES (?, ?)
bind => [5, Value 84]
|