Skip to content

Add JavaDoc mainly to SessionContext#64

Open
ChrisChros123 wants to merge 3 commits into
teamapps-org:masterfrom
ChrisChros123:add_documentation
Open

Add JavaDoc mainly to SessionContext#64
ChrisChros123 wants to merge 3 commits into
teamapps-org:masterfrom
ChrisChros123:add_documentation

Conversation

@ChrisChros123
Copy link
Copy Markdown

@ChrisChros123 ChrisChros123 commented Dec 15, 2021

createResourceLInk was only moved to be next to createFileLink

@ChrisChros123 ChrisChros123 changed the title Add JavaDoc mainly for SessionContext Add JavaDoc mainly to SessionContext Dec 15, 2021
Copy link
Copy Markdown
Member

@yamass yamass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your help!!

import java.util.function.Supplier;

/**
* Interface for handling any type of data source that can be represented as an InputStream.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true. However, the main idea is that Resources are meant to be downloaded by the client using HTTP. Therefore, they provide all the necessary HTTP header information in addition to the data.


/**
* Provides access to several aspects of a Ui-Session and allows sending commands and updates to the client.
* A UI-session starts upon opening the website and ends when leaving or reloading it. The Communication between client
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking: Please use spaces for compound words like UI session.

import static org.teamapps.common.util.ExceptionUtil.softenExceptions;

/**
* Provides access to several aspects of a Ui-Session and allows sending commands and updates to the client.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Represents a UI session and thereby ...

* A UI-session starts upon opening the website and ends when leaving or reloading it. The Communication between client
* and server happens via websocket.
* Only one thread can interact with a Ui-Session at a time. Therefore, all interactions with the session context from
* outside must be done using the {@link #runWithContext(Runnable)} method.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also mention that

  • events coming from the client are generally handled in a thread bound to the UI Session.

* Provides access to several aspects of a Ui-Session and allows sending commands and updates to the client.
* A UI-session starts upon opening the website and ends when leaving or reloading it. The Communication between client
* and server happens via websocket.
* Only one thread can interact with a Ui-Session at a time. Therefore, all interactions with the session context from
Copy link
Copy Markdown
Member

@yamass yamass Dec 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single thread access is important for mainly two reasons:

  • to guarantee a certain order of events on the client and server side (most important: both process changes in the same order)
  • because none of the UI Components is thread-safe

}

/**
* @return the SessionContext which the thread, where this method is executed in, is bound to
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... which the current thread is bound to

/**
* @param runnable
* Executes the runnable within a thread that is bound to the SessionContext.
* This ensures thread safety by letting only one thread interact with a UI-session at a time.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also mention that the Runnable/Callable is not necessarily executed asynchronously but might actually be executed synchronously if the thread happens to be already bound to this SessionContext.

I also think that it makes sense to add the JavaDoc comment to runWithContext(Callable<R> runnable, boolean forceEnqueue).

* in the <b>same</b> order)</li>
* <li>because none of the UI components is thread-safe</li>
* </ul>
* Therefore, all interactions with the session context from outside must be done using the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the session context and any UI components


/**
* @return the SessionContext which the thread, where this method is executed in, is bound to
* @return the SessionContext which the thread is bound to where this method is executed in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@return the SessionContext which the current thread is bound to

The rest of the sentence is redundant

Copy link
Copy Markdown
Member

@yamass yamass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants