java

JSF/JDBC - Excessive requests on database  #angularjs #reactjs

  • 1483133453514] [levelValue: 800] [[ Loading application [__admingui] at [/]]] [2016-12-30T23:30:53.516+0200] [glassfish 4.1] [INFO] [NCLS-CORE-00022] [javax.enterprise.system.core] [tid: _ThreadID=91 _ThreadName=Thread-21] [timeMillis: 1483133453516] [levelValue: 800] [[ Loading application __admingui done in 5Â 049 ms]] [2016-12-30T23:31:14.132+0200] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=26 _ThreadName=http-listener-1(2)] [timeMillis: 1483133474132] [levelValue: 800] [[ visiting unvisited references]] [2016-12-30T23:31:17.500+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477500] [levelValue: 800] [[ info: before while]] [
  • I’m developing simple JSF application, running on GlassFish 4.1.
  • Helloww, #{user.username}, have a nice day))

    Book ID #{b.getId()} Book ISBN #{b.getIsbn()} Book name #{b.getName()}

    #{library.getBooks(true).

  • About us tour help blog chat data legal privacy policy work advertising info mobile contact us feedback
  • Stack Overflow works best with JavaScript enabled

I’m trying to read data from MySQL database, and my program do it several times,
I don’t need this. I’m developing simple JSF application, running on GlassFish 4.1.

@ng_real_ninja: JSF/JDBC – Excessive requests on database #angularjs #reactjs

Helloww, #{user.username}, have a nice day))

Book ID #{b.getId()} Book ISBN #{b.getIsbn()} Book name #{b.getName()}

#{library.getBooks(true).size()}

Max memory: #{libraryChecker.maxMemory}

Used memory: #{libraryChecker.currentMemory}

// Book.java @ManagedBean @SessionScoped public class Book { private int id; private String name; private String isbn; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } } //Library.java @ManagedBean(name = “library”) @SessionScoped public class Library { private static final String SQL_GET_ALL_BOOKS = “SELECT * FROM book”; private Set books; private InitialContext icon; private DataSource ds; public Library() { if (books == null) books = new LinkedHashSet(); try { icon = new InitialContext(); ds = (DataSource) icon.lookup(“jdbc/library”); } catch (NamingException e) { e.printStackTrace(); } } public Set getBooks(boolean ifOnlyGet) { if (!ifOnlyGet) readBooks(); return books; } private void readBooks() { try { Connection con = ds.getConnection(); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(SQL_GET_ALL_BOOKS); System.out.println(“info: before while”); while (rs.next()) { Book book = new Book(); book.setId(rs.getInt(“id”)); book.setName(rs.getString(“name”)); book.setIsbn(rs.getString(“isbn”)); books.add(book); System.out.println(rs.getInt(“id”)); } con.close(); } catch (SQLException e) { e.printStackTrace(); } } }

[2016-12-30T23:30:49.722+0200] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=42 _ThreadName=admin-listener(4)] [timeMillis: 1483133449722] [levelValue: 800] [[ IMVN-WEB_demo1 was successfully deployed in 4 512 milliseconds.]] [2016-12-30T23:30:51.843+0200] [glassfish 4.1] [INFO] [jsf.config.listener.version] [javax.enterprise.resource.webcontainer.jsf.config] [tid: _ThreadID=91 _ThreadName=Thread-21] [timeMillis: 1483133451843] [levelValue: 800] [[ Initializing Mojarra 2.2.7 ( 20140610-1547 https://svn.java.net/svn/mojarra~svn/tags/2.2.7@13362) for context ”]] [2016-12-30T23:30:53.514+0200] [glassfish 4.1] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=91 _ThreadName=Thread-21] [timeMillis: 1483133453514] [levelValue: 800] [[ Loading application [__admingui] at [/]]] [2016-12-30T23:30:53.516+0200] [glassfish 4.1] [INFO] [NCLS-CORE-00022] [javax.enterprise.system.core] [tid: _ThreadID=91 _ThreadName=Thread-21] [timeMillis: 1483133453516] [levelValue: 800] [[ Loading application __admingui done in 5 049 ms]] [2016-12-30T23:31:14.132+0200] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.dol] [tid: _ThreadID=26 _ThreadName=http-listener-1(2)] [timeMillis: 1483133474132] [levelValue: 800] [[ visiting unvisited references]] [2016-12-30T23:31:17.500+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477500] [levelValue: 800] [[ info: before while]] [2016-12-30T23:31:17.502+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477502] [levelValue: 800] [[ 3]] [2016-12-30T23:31:17.502+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477502] [levelValue: 800] [[ 4]] [2016-12-30T23:31:17.502+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477502] [levelValue: 800] [[ 5]] [2016-12-30T23:31:17.504+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477504] [levelValue: 800] [[ 6]] [2016-12-30T23:31:17.505+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477505] [levelValue: 800] [[ 7]] [2016-12-30T23:31:17.506+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477506] [levelValue: 800] [[ 9]] [2016-12-30T23:31:17.506+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477506] [levelValue: 800] [[ 10]] [2016-12-30T23:31:17.507+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477507] [levelValue: 800] [[ 12]] [2016-12-30T23:31:17.507+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133477507] [levelValue: 800] [[ 13]] [2016-12-30T23:31:19.226+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479226] [levelValue: 800] [[ info: before while]] [2016-12-30T23:31:19.227+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479227] [levelValue: 800] [[ 3]] [2016-12-30T23:31:19.227+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479227] [levelValue: 800] [[ 4]] [2016-12-30T23:31:19.227+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479227] [levelValue: 800] [[ 5]] [2016-12-30T23:31:19.228+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479228] [levelValue: 800] [[ 6]] [2016-12-30T23:31:19.228+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479228] [levelValue: 800] [[ 7]] [2016-12-30T23:31:19.228+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479228] [levelValue: 800] [[ 9]] [2016-12-30T23:31:19.228+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479228] [levelValue: 800] [[ 10]] [2016-12-30T23:31:19.228+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479228] [levelValue: 800] [[ 12]] [2016-12-30T23:31:19.228+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479228] [levelValue: 800] [[ 13]] [2016-12-30T23:31:19.734+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479734] [levelValue: 800] [[ info: before while]] [2016-12-30T23:31:19.735+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479735] [levelValue: 800] [[ 3]] [2016-12-30T23:31:19.735+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479735] [levelValue: 800] [[ 4]] [2016-12-30T23:31:19.735+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479735] [levelValue: 800] [[ 5]] [2016-12-30T23:31:19.735+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479735] [levelValue: 800] [[ 6]] [2016-12-30T23:31:19.735+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479735] [levelValue: 800] [[ 7]] [2016-12-30T23:31:19.735+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479735] [levelValue: 800] [[ 9]] [2016-12-30T23:31:19.736+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479736] [levelValue: 800] [[ 10]] [2016-12-30T23:31:19.740+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479740] [levelValue: 800] [[ 12]] [2016-12-30T23:31:19.740+0200] [glassfish 4.1] [INFO] [] [] [tid: _ThreadID=26 _ThreadName=Thread-8] [timeMillis: 1483133479740] [levelValue: 800] [[ 13]]

java

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.