Menu
New Swift project handles server app start-up, shutdown

New Swift project handles server app start-up, shutdown

Swift Service Lifecycle is an open source project aimed at supporting the language’s server ecosystem

Credit: Dreamstime

The developers behind Apple’s Swift language have introduced an open source project for the Swift server ecosystem, called Swift Service Lifecycle, to aid server applications with managing start-up and shutdown sequences.

Accessible from GitHub, Swift Service Lifecycle is a Swift package that cleanly starts up and shuts down an application, freeing resources before exiting. Also provided is a Signal-based shutdown hook to shut down on signals TERM or INT.

Swift Service Lifecycle was designed with the notion that each application has start-up and workflow-like logic that often is sensitive to failure and difficult to do correctly.

Start-up sequences include actions like initialising thread pools, warming up caches, running data migrations, and performing other types of state initialisation prior to accepting events or taking traffic. Shutdown sequences free up resources that hold on to file descriptors or other resources that could leak if not correctly cleared.

Swift Service Lifecycle codes this common need for start-up and shutdown logic in a safe, reusable way that is non-framework-specific.

The recommended way to use the library is to create a ServiceLifecycle instance in an application’s main method and register LifecycleTasks. When calling the start function, ServiceLifecycle will start these tasks in the order registered. ServiceLifecycle also registers a signal handler that traps TERM or INT.

Swift’s potential on the server has grabbed the attention of companies such as IBM. Swift was founded in 2014 as the successor to Apple’s Objective-C language for developing on Apple platforms such as MacOS and iOS.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags open sourceApple

Events

Featured

Slideshows

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners

This year’s Reseller News 30 Under 30 Tech Awards were held as an integral part of the first entirely virtual Emerging Leaders​ forum, an annual event dedicated to identifying, educating and showcasing the New Zealand technology market’s rising stars. The 30 Under 30 Tech Awards 2020 recognised the outstanding achievements and business excellence of 30 talented individuals​, across both young leaders and those just starting out. In this slideshow, Reseller News honours this year's winners and captures their thoughts about how their ideas of leadership have changed over time.​

Meet the Reseller News 30 Under 30 Tech Awards 2020 winners
Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security

Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security

This exclusive Reseller News Exchange event in Auckland explored the challenges facing the partner community on the cloud security frontier, as well as market trends, customer priorities and how the channel can capitalise on the opportunities available. In association with Arrow, Bitdefender, Exclusive Networks, Fortinet and Palo Alto Networks. Photos by Gino Demeer.

Reseller News Exchange Auckland: Beyond the myths — how partners can master cloud security
Reseller News welcomes industry figures at 2020 Hall of Fame lunch

Reseller News welcomes industry figures at 2020 Hall of Fame lunch

Reseller News welcomed 2019 inductees - Leanne Buer, Ross Jenkins and Terry Dunn - to the fourth running of the Reseller News Hall of Fame lunch, held at the French Cafe in Auckland. The inductees discussed the changing face of the IT channel ecosystem in New Zealand and what it means to be a Reseller News Hall of Fame inductee. Photos by Gino Demeer.

Reseller News welcomes industry figures at 2020 Hall of Fame lunch
Show Comments