Understanding Run Units and Sessions

Before you delve into the fundamentals of Web applications, you need to understand the concept of Micro Focus run units and sessions.

Many COBOL applications are single-user programs, so adapting these programs into a multi-user Java environment can be problematic. You may experience a problem such as file locking or memory isolation breaking down because the same resource set is being used by many users. Often, fixing this contention requires a significant rewriting of code.

Micro Focus solves this with a construct called a run unit, and is specified by the JVM COBOL runtime class com.microfocus.cobol.runtimeservices.RunUnit. Each run unit is a new session object, and contains its own memory space and file lock table. A JVM COBOL program in one run unit will not normally access the memory of a program in another run unit. There is isolation between them. In addition, file locks are held for each run unit. If a program in one run unit holds a file lock, it will not be accessible to a file handling program in another run unit in the same process.

This feature is implemented using the concept of a Run Unit Manager. Each manager controls the life-cycle of run unit objects in Java environments with a notion of a session. A manager:

The class com.microfocus.cobol.runtimeservices.servlet.ServletRunUnitManager in the JVM COBOL runtime exists to handle the life-cycle of run units in the context of servlet API HttpSession objects.