Multithreaded Vaadin- applications, what are the key concepts?

I welcome!

Is the
Vaadin
- library thread-safe? If we draw an analogy with
Swing
, then how full it is? For example, there is, whether the concept of
"flow events manager
" and techniques such as -


...
invokeLater();
...
invokeAndWait();
...

…?
For example, faced with this problem - to give the user while waiting for the results of the request an opportunity to make more requests -
11939.png

I get these results -
11940.png

…and the two classes of exceptions which are excited in my listener, which is protected by
ReentrantLock
:

public void buttonClick(ClickEvent event) {
	Thread workThread = new Thread() {
		@Override
		public void run() {
			lock.lock();
			try {
				ResultQueryWin resultQueryWin = new ResultQueryWin(screenWindow, outerSystemQuery, 
						selectedTab, userWorkSpace, paramSettersWnds, selectedTab);
				screenWindow.addWindow(resultQueryWin);
			}
			finally {
				lock.unlock();
			}
		}															
	};					
	workThread.start();
		WaitPartGenerator waitPartGenerator = new WaitPartGenerator(chartsButtonsBar, workThread, setInQueryParameters, setOutQueryParameters);
		waitPartGenerator.addWaitPart();
	}
}


java.sql.SQLException
here -


...
ResultQueryWin resultQueryWin = new ResultQueryWin(screenWindow, outerSystemQuery, 
						selectedTab, userWorkSpace, paramSettersWnds, selectedTab);

...

…and
java.lang.IllegalStateException
:
A transaction is already active!
here -


...
screenWindow.addWindow(resultQueryWin);
...

An exception
java.sql.SQLException
is raised in this way -


ResultQueryWin.java
-


...
[color=#f00d0d]
final Table t = new Table(null, innerSystemQuery.executeQuery());
[/color]		
t.setSizeFull();
t.setStyleName("iso3166");
t.setSelectable(true);        		        
t.setImmediate(true); 
t.setColumnReorderingAllowed(true);        
t.setColumnCollapsingAllowed(true);
t.setColumnHeaderMode(Table.ROW_HEADER_MODE_INDEX);	
...

…method executeQuery() in
InnerSystemQuery.java
-

	public Table executeQuery() {
		createQuery();
		String sql = getQuery();		
		StringParser stringParser = new StringParser();
				
		SimpleJDBCConnectionPool connPool = null;
		try {
			connPool = new SimpleJDBCConnectionPool("oracle.jdbc.OracleDriver",
					"jdbc:oracle:thin:@gissde:1522:EF", "......", "............", 2, 5);
		} catch(SQLException e1) {
			e1.printStackTrace();
		}

		FreeformQuery query = null;		
		query = new FreeformQuery(sql, connPool);
							
		SQLContainer container = null;
		try {   
			[color=#fc0707]
container = new SQLContainer(query);
[/color]						 
		} 
		catch (SQLException e) {           
			e.printStackTrace();
		}

		final Table t = new Table(null, container);		
		t.setSelectable(true);        		        
		t.setImmediate(true); 
		t.setWidth("300px");
		
		return t;
	}

Does any one know? :smiley:

I did not read the SQL parts of your thread, but the general rule with Vaadin is that each access to a Vaadin component (including accesses container modifications make via listeners etc.) must by synchronized to the application instance.

Each request from the client is a single operation from the client’s point of view. If you want things to happen in the background, use a background thread and either polling or a push mechanism.

See
this thread
for more information.

I welcome you, Henri Sara!

I think it makes sense to make a chapter in the
Book of Vaadin
, a fairly common problem. :smiley:
Thank you very much for your help!