Skip to content

Latest commit

 

History

History
238 lines (190 loc) · 7.41 KB

File metadata and controls

238 lines (190 loc) · 7.41 KB

platform-java - Project Status

Summary

platform-java is a Java application platform designed to run multiple independent Java applications within a single JVM with comprehensive isolation - similar to running them in separate terminal windows, but with managed resources and optional inter-app communication.

What's Been Created

✅ Complete Maven Multi-Module Structure

platform-java/
├── pom.xml (parent aggregator)
├── platform-java-api/              ✅ COMPLETE - 22 interface/class files
├── platform-java-core/             📦 Structure ready
├── platform-java-classloader/      📦 Structure ready
├── platform-java-threadpool/       📦 Structure ready
├── platform-java-security/         📦 Structure ready
├── platform-java-monitoring/       📦 Structure ready
├── platform-java-messaging/        📦 Structure ready
├── platform-java-deployment/       📦 Structure ready
├── platform-java-launcher/         📦 Structure ready
└── platform-java-samples/          📦 Structure ready

✅ Complete API Module (platform-java-api)

Core Application APIs:

  • Application - Application lifecycle interface
  • ApplicationContext - Runtime context with access to all platform features
  • ApplicationDescriptor - Deployment metadata
  • ApplicationState - Lifecycle state enum
  • ApplicationLifecycleListener - Event listener for lifecycle changes

Thread Pool APIs:

  • ThreadPoolExecutor - Managed thread pool interface
  • ThreadPoolConfig - Thread pool configuration
  • ThreadPoolStats - Thread pool metrics

Security APIs:

  • SecurityPolicy - Security enforcement interface
  • SecurityConfig - Security configuration

Resource Monitoring APIs:

  • ResourceMonitor - Resource tracking interface
  • ResourceSnapshot - Point-in-time resource metrics
  • ResourceQuota - Resource limit configuration
  • ResourceUsageHistory - Historical metrics
  • ResourceEventListener - Resource event notifications
  • ResourceConfig - Resource configuration

Messaging APIs (Optional):

  • MessageBus - Publish/subscribe messaging
  • Message - Message data structure
  • MessageHandler - Message handler interface
  • Subscription - Subscription handle
  • ServiceRegistry - Service registration and lookup

Architecture Highlights

ClassLoader Isolation

PlatformSharedClassLoader (platform-java-api - shared)
    ├── App1ClassLoader (parent-last delegation)
    ├── App2ClassLoader (parent-last delegation)
    └── App3ClassLoader (parent-last delegation)

Deployment Options

  • File system (drop JARs, auto-detect)
  • Programmatic API
  • CLI/Console
  • Configuration files (YAML/JSON/XML)
  • REST API (planned)
  • Socket-based (planned)

Isolation Features

  1. ClassLoader Isolation - Prevents version conflicts
  2. Thread Pool Isolation - Per-app thread pools with limits
  3. Security Isolation - Configurable permissions
  4. Resource Monitoring - CPU, memory, thread tracking

Optional Communication

  • Applications can opt-in to messaging
  • Event bus for publish/subscribe
  • Service registry for service lookup
  • Complete isolation for apps that don't need it

Build Status

✅ API module compiles successfully ✅ Maven structure validates 📦 Ready for core implementation

Next Steps

Immediate (Phase 1 - MVP)

  1. Implement IsolatedClassLoader (platform-java-classloader)

    • Parent-last delegation for app classes
    • Parent-first for platform APIs
    • Resource tracking for cleanup
  2. Implement ManagedThreadPool (platform-java-threadpool)

    • Wrapper around java.util.concurrent.ThreadPoolExecutor
    • Thread naming with applicationId
    • Graceful shutdown
    • Statistics tracking
  3. Implement ApplicationManager (platform-java-core)

    • Application registry
    • Lifecycle state machine
    • Coordination of isolation subsystems
    • ApplicationContext implementation
  4. Basic Platform Launcher (platform-java-launcher)

    • Bootstrap process
    • Configuration loading
    • Shutdown hooks

Phase 2 - Deployment

  1. File system deployment provider
  2. CLI deployment interface
  3. Config file deployment

Phase 3 - Advanced Isolation

  1. Security policy implementation
  2. Resource monitoring implementation

Phase 4 - Communication & Production

  1. Messaging implementation
  2. Monitoring exporters (JMX, Prometheus)
  3. Sample applications
  4. Integration tests

Design Decisions Made

✅ Decided

  • Build System: Maven (multi-module)
  • Java Version: Java 11+ (target 11, compatible with 17+)
  • Isolation Levels: All four (ClassLoader, ThreadPool, Security, ResourceMonitor)
  • Security Approach: Dual mode (SecurityManager for Java 8-16, instrumentation for 17+)
  • Resource Monitoring: ThreadMXBean for CPU, estimated heap tracking, optional JVMTI agent
  • Communication: Optional opt-in (MessageBus + ServiceRegistry)
  • Application Types: Support both Application interface and plain main() methods

📋 To Be Decided

  • REST API framework (Spring Boot vs embedded Jetty vs Javalin)
  • CLI framework (picocli vs JCommander)
  • Configuration format priority (YAML primary vs JSON vs XML)
  • Logging framework specifics (already using SLF4J + Logback)
  • Test framework details (already using JUnit 5)

How to Use (Once Implemented)

Platform-Aware Application

public class MyApp implements Application {
    @Override
    public void start(ApplicationContext context) {
        context.getThreadPool().submit(() -> {
            // Do work
        });
        
        context.getMessageBus().ifPresent(bus -> {
            bus.subscribe("events", msg -> {
                // Handle message
            });
        });
    }
    
    @Override
    public void stop() {
        // Cleanup
    }
}

Legacy Application

public class LegacyApp {
    public static void main(String[] args) {
        // Standard Java app - runs in isolation
    }
}

Deployment

ApplicationManager manager = new ApplicationManager();

ApplicationDescriptor descriptor = ApplicationDescriptor.builder()
    .applicationId("my-app")
    .mainClass("com.example.MyApp")
    .addClasspathEntry(new File("my-app.jar").toURI())
    .threadPoolConfig(ThreadPoolConfig.builder()
        .corePoolSize(4)
        .maxPoolSize(10)
        .build())
    .enableMessaging(true)
    .build();

manager.deploy(descriptor);
manager.start("my-app");

Documentation

  • README.md - Project overview and architecture
  • PROJECT_STATUS.md - This file
  • 📋 JavaDoc (to be generated)
  • 📋 User Guide (to be written)
  • 📋 Developer Guide (to be written)

Current State

Lines of Code: ~1,000+ (API definitions) Test Coverage: 0% (no tests yet) Working Features: API definitions complete Build Time: < 2 seconds Build Status: ✅ SUCCESS

Contributors

  • Scot P. Floess (initial design and architecture)

Timeline Estimate

  • Phase 1 (MVP): 2-3 weeks - Basic deployment, ClassLoader, ThreadPool, lifecycle
  • Phase 2 (Deployment): 1-2 weeks - Filesystem, CLI, config-based deployment
  • Phase 3 (Isolation): 1-2 weeks - Security, resource monitoring
  • Phase 4 (Advanced): 2-3 weeks - Messaging, REST API, monitoring exporters
  • Phase 5 (Production): Ongoing - JVMTI agent, clustering, web console

Total to Production-Ready: ~2-3 months part-time

Questions?

See README.md for architecture details and design decisions.