Java EE Concepts: Interceptors, Hibernate, JPA, and Servlets
EJB Interceptors Explained
An interceptor is a class or method that intercepts EJB method calls or lifecycle events. It is used for common tasks like logging, security, transactions, and auditing. It helps avoid duplicate code and keeps business logic separate from system logic. Interceptors can be defined as a separate class or inside the bean. They use annotations to define behavior.
@AroundInvoke is used for method interception, while @PostConstruct and @PreDestroy are used for lifecycle interception.
I/O Management Fundamentals for System Design
I/O Device Fundamentals
Block Devices
Devices that store data in fixed-size blocks (e.g., 512 bytes or 4 KB) and allow for random access. Examples include hard drives, SSDs, and DVDs.
Character Devices
Devices that send or receive a stream of characters. Examples include the keyboard, mouse, and serial ports.
Why can’t you seek with character devices? Data arrives as a real-time stream, making random access impossible.
Memory-Mapped vs. Separate I/O
Separate I/O
The CPU uses special instructions to communicate
Read MoreOperating System File Management: Structure, Implementation, and Operations
File System Structure Fundamentals
A file system is the component of the operating system (OS) that manages the creation, storage, organization, and access of files on storage devices (e.g., hard disks, SSDs, pen drives). The file system structure defines how files are arranged, how directories are organized, and how the OS locates and stores data.
Main Components of File System Structure
1. Files
A file is a collection of related information stored together—such as a text file, image, or video.
Each
Read MoreCore Design Principles and Architectural Models for Distributed Systems
Distributed Systems Architectures (CPSC 5520, Fall 2022)
Instructor: Kevin Lundeen
Design Considerations in Distributed Systems
This section covers the fundamental criteria and challenges involved in designing robust distributed systems.
Design Criteria vs. Motivation
Compare this design considerations topic to the motivations presented in the Overview Lecture (slide 16):
Key Design Criteria
-
Support Sharing of Resources
Examples:
- Cloud-based shared storage and files
- Peer-to-peer assisted multimedia streaming
- Shared
Operating System Concepts: Virtual Memory and I/O Mechanisms
What Is Virtual Memory?
Virtual memory is a memory management technique that gives programs the illusion of having a large, continuous block of memory—even if the physical RAM is limited. It allows the system to use disk space (like HDD/SSD) as an extension of RAM.
Key Capabilities Enabled by Virtual Memory
- Running large applications
- Multitasking
- Memory protection and isolation
Virtual Memory Implementation Methods
Paging
Memory is divided into fixed-size blocks:
- Pages (virtual memory)
- Frames (physical
C Programming Fundamentals and Sorting Algorithms Reference
C Program: Find and Count Array Element Occurrences
Objective: Write a C program to find all positions where a specific value (9) is present in a user-defined list and count its total occurrences.
Given Sample List (entered at runtime): 3, 2, 10, 9, 7, 1, 5, 21, 8, 5. This should print: “9 is present at 4th position.”
C Implementation (1-Based Indexing)
#include <stdio.h>
int main() {
int n, i, count = 0, x = 9;
printf("Enter number of elements: ");
scanf("%d", &n);
int a[ Read More
